ing
This commit is contained in:
parent
fda60823d6
commit
e35dbc4cce
|
@ -4,11 +4,10 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"git.loafle.net/commons_go/rpc/protocol"
|
|
||||||
"git.loafle.net/commons_go/server"
|
"git.loafle.net/commons_go/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
func New(sh ServerHandler) Server {
|
func New(sh ServerHandler) server.Server {
|
||||||
lsh := &serverHandlers{}
|
lsh := &serverHandlers{}
|
||||||
lsh.ServerHandler = sh
|
lsh.ServerHandler = sh
|
||||||
lsh.lsh = sh
|
lsh.lsh = sh
|
||||||
|
@ -31,14 +30,15 @@ func (sh *serverHandlers) Handle(conn net.Conn, stopChan <-chan struct{}, doneCh
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var codecReq protocol.ServerCodecRequest
|
|
||||||
|
|
||||||
Loop:
|
|
||||||
for {
|
for {
|
||||||
sh.lsh.OnPreRead(conn)
|
sh.lsh.OnPreRead(conn)
|
||||||
// Create a new codec request.
|
// Create a new codec request.
|
||||||
codecReq, errNew := codec.NewRequest(conn)
|
codecReq, errNew := codec.NewRequest(conn)
|
||||||
if nil != errNew {
|
if nil != errNew {
|
||||||
|
if sh.IsClientDisconnect(errNew) {
|
||||||
|
doneChan <- struct{}{}
|
||||||
|
return
|
||||||
|
}
|
||||||
log.Printf("RPC Handle: %v", errNew)
|
log.Printf("RPC Handle: %v", errNew)
|
||||||
doneChan <- struct{}{}
|
doneChan <- struct{}{}
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user