提交 80a8c690 编写于 作者: U UlricQin

fix conn shutdown when transfer restart

上级 0951f1f1
......@@ -43,3 +43,9 @@ func (rcc *RpcClientContainer) Put(addr string, client *rpc.Client) bool {
rcc.M[addr] = client
return true
}
func (rcc *RpcClientContainer) Del(addr string) {
rcc.Lock()
defer rcc.Unlock()
delete(rcc.M, addr)
}
......@@ -110,7 +110,7 @@ func rpcCall(addr string, items []*dataobj.MetricValue) (dataobj.TransferResp, e
return reply, fmt.Errorf("%s rpc call timeout", addr)
case err := <-done:
if err != nil {
rpcClients.Put(addr, nil)
rpcClients.Del(addr)
client.Close()
return reply, fmt.Errorf("%s rpc call done, but fail: %v", addr, err)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册