1.优化网络库

2.rpc协议在宕机时不会导致整个rpc无法响应
This commit is contained in:
boyce
2020-02-05 17:51:51 +08:00
parent 29b04d82c3
commit 7fd97033ec
5 changed files with 28 additions and 7 deletions

View File

@@ -324,7 +324,7 @@ func (server *Server) register(rcvr interface{}, name string, prefix string, use
_, ok := server.mapCallQueue[sname]
if ok == false {
server.mapCallQueue[sname] = make(chan *CQueueRpcData, 10240)
util.Go(server.ProcessQueue, sname)
util.GoRecover(server.ProcessQueue,-1, sname)
}
if useName {
sname = name
@@ -612,7 +612,8 @@ func (server *Server) ServeCodec(codec ServerCodec) {
wg.Add(1)
//queueMode
//fmt.Print(queueMode)
go service.call(server, sending, wg, mtype, req, argv, replyv, codec)
util.Go(service.call,server, sending, wg, mtype, req, argv, replyv, codec)
//go service.call(server, sending, wg, mtype, req, argv, replyv, codec)
}
// We've seen that there are no more requests.
// Wait for responses to be sent before closing codec.