diff --git a/server/server.go b/server/server.go index 0db7018..78206b4 100644 --- a/server/server.go +++ b/server/server.go @@ -4,11 +4,10 @@ import ( "log" "net" - "git.loafle.net/commons_go/rpc/protocol" "git.loafle.net/commons_go/server" ) -func New(sh ServerHandler) Server { +func New(sh ServerHandler) server.Server { lsh := &serverHandlers{} lsh.ServerHandler = sh lsh.lsh = sh @@ -31,14 +30,15 @@ func (sh *serverHandlers) Handle(conn net.Conn, stopChan <-chan struct{}, doneCh return } - var codecReq protocol.ServerCodecRequest - -Loop: for { sh.lsh.OnPreRead(conn) // Create a new codec request. codecReq, errNew := codec.NewRequest(conn) if nil != errNew { + if sh.IsClientDisconnect(errNew) { + doneChan <- struct{}{} + return + } log.Printf("RPC Handle: %v", errNew) doneChan <- struct{}{} return