Strip some dead code
This commit is contained in:
parent
ef04331b86
commit
88817dc53f
@ -75,8 +75,6 @@ func (s *rpcServer) ServeConn(sock transport.Socket) {
|
|||||||
var mtx sync.RWMutex
|
var mtx sync.RWMutex
|
||||||
sockets := make(map[string]*socket.Socket)
|
sockets := make(map[string]*socket.Socket)
|
||||||
|
|
||||||
log.Info("New socket")
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
var msg transport.Message
|
var msg transport.Message
|
||||||
if err := sock.Recv(&msg); err != nil {
|
if err := sock.Recv(&msg); err != nil {
|
||||||
@ -103,16 +101,10 @@ func (s *rpcServer) ServeConn(sock transport.Socket) {
|
|||||||
psock, ok := sockets[id]
|
psock, ok := sockets[id]
|
||||||
mtx.RUnlock()
|
mtx.RUnlock()
|
||||||
|
|
||||||
log.Infof("Got socket %v %v", id, ok)
|
|
||||||
|
|
||||||
// got the socket
|
// got the socket
|
||||||
if ok {
|
if ok {
|
||||||
// accept the message
|
// accept the message
|
||||||
if err := psock.Accept(&msg); err != nil {
|
if err := psock.Accept(&msg); err != nil {
|
||||||
log.Infof("Accept Error %+v", err)
|
|
||||||
// close the socket
|
|
||||||
psock.Close()
|
|
||||||
|
|
||||||
// delete the socket
|
// delete the socket
|
||||||
mtx.Lock()
|
mtx.Lock()
|
||||||
delete(sockets, id)
|
delete(sockets, id)
|
||||||
@ -149,8 +141,6 @@ func (s *rpcServer) ServeConn(sock transport.Socket) {
|
|||||||
// get the message from our internal handler/stream
|
// get the message from our internal handler/stream
|
||||||
m := new(transport.Message)
|
m := new(transport.Message)
|
||||||
if err := psock.Process(m); err != nil {
|
if err := psock.Process(m); err != nil {
|
||||||
log.Infof("Process Error %+v", err)
|
|
||||||
|
|
||||||
// delete the socket
|
// delete the socket
|
||||||
mtx.Lock()
|
mtx.Lock()
|
||||||
delete(sockets, id)
|
delete(sockets, id)
|
||||||
@ -287,8 +277,6 @@ func (s *rpcServer) ServeConn(sock transport.Socket) {
|
|||||||
delete(sockets, id)
|
delete(sockets, id)
|
||||||
mtx.Unlock()
|
mtx.Unlock()
|
||||||
|
|
||||||
psock.Close()
|
|
||||||
|
|
||||||
// once done serving signal we're done
|
// once done serving signal we're done
|
||||||
if s.wg != nil {
|
if s.wg != nil {
|
||||||
s.wg.Done()
|
s.wg.Done()
|
||||||
|
@ -123,16 +123,6 @@ func (s *Socket) Close() error {
|
|||||||
return nil
|
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.
|
// 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.
|
// Messages are sent to the socket via Accept and receives from the socket via Process.
|
||||||
// SetLocal/SetRemote should be called before using the socket.
|
// SetLocal/SetRemote should be called before using the socket.
|
||||||
|
Loading…
Reference in New Issue
Block a user