This commit is contained in:
crusader 2017-11-01 15:21:49 +09:00
parent fda60823d6
commit e35dbc4cce

View File

@ -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