优化网络层的GC

This commit is contained in:
boyce
2020-10-29 19:40:44 +08:00
parent 54f1db7641
commit 5e30083ce8
6 changed files with 36 additions and 7 deletions

View File

@@ -265,6 +265,7 @@ func (slf *Client) Run(){
processor := GetProcessor(uint8(bytes[0]))
if processor==nil {
slf.conn.ReleaseReadMsg(bytes)
log.Error("rpcClient %s ReadMsg head error:%+v",slf.Addr,err)
return
}
@@ -274,6 +275,7 @@ func (slf *Client) Run(){
respone.RpcResponeData =processor.MakeRpcResponse(0,nil,nil)
err = processor.Unmarshal(bytes[1:],respone.RpcResponeData)
slf.conn.ReleaseReadMsg(bytes)
if err != nil {
processor.ReleaseRpcRespose(respone.RpcResponeData)
log.Error("rpcClient Unmarshal head error,error:%+v",err)

View File

@@ -125,6 +125,7 @@ func (agent *RpcAgent) Run() {
}
processor := GetProcessor(uint8(data[0]))
if processor==nil {
agent.conn.ReleaseReadMsg(data)
log.Error("remote rpc %s data head error:%+v",agent.conn.RemoteAddr(),err)
return
}
@@ -134,6 +135,7 @@ func (agent *RpcAgent) Run() {
req.rpcProcessor = processor
req.RpcRequestData = processor.MakeRpcRequest(0,"",false,nil,nil)
err = processor.Unmarshal(data[1:],req.RpcRequestData)
agent.conn.ReleaseReadMsg(data)
if err != nil {
log.Error("rpc Unmarshal request is error: %v", err)
if req.RpcRequestData.GetSeq()>0 {