fix conn shutdown when transfer restart
This commit is contained in:
parent
0951f1f1af
commit
80a8c6900a
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue