Strip some dead code

This commit is contained in:
Asim Aslam 2019-08-15 20:54:00 +01:00
parent ef04331b86
commit 88817dc53f
2 changed files with 0 additions and 22 deletions

View File

@ -75,8 +75,6 @@ func (s *rpcServer) ServeConn(sock transport.Socket) {
var mtx sync.RWMutex
sockets := make(map[string]*socket.Socket)
log.Info("New socket")
for {
var msg transport.Message
if err := sock.Recv(&msg); err != nil {
@ -103,16 +101,10 @@ func (s *rpcServer) ServeConn(sock transport.Socket) {
psock, ok := sockets[id]
mtx.RUnlock()
log.Infof("Got socket %v %v", id, ok)
// got the socket
if ok {
// accept the message
if err := psock.Accept(&msg); err != nil {
log.Infof("Accept Error %+v", err)
// close the socket
psock.Close()
// delete the socket
mtx.Lock()
delete(sockets, id)
@ -149,8 +141,6 @@ func (s *rpcServer) ServeConn(sock transport.Socket) {
// get the message from our internal handler/stream
m := new(transport.Message)
if err := psock.Process(m); err != nil {
log.Infof("Process Error %+v", err)
// delete the socket
mtx.Lock()
delete(sockets, id)
@ -287,8 +277,6 @@ func (s *rpcServer) ServeConn(sock transport.Socket) {
delete(sockets, id)
mtx.Unlock()
psock.Close()
// once done serving signal we're done
if s.wg != nil {
s.wg.Done()

View File

@ -123,16 +123,6 @@ func (s *Socket) Close() error {
return nil
}
// Indicates its closed
func (s *socket) Done() bool {
select {
case <-s.closed:
return true
default:
return false
}
}
// New returns a new pseudo socket which can be used in the place of a transport socket.
// Messages are sent to the socket via Accept and receives from the socket via Process.
// SetLocal/SetRemote should be called before using the socket.