pool: Clear connection before releasing

This to be consistent with other connection clean up handler as well as consul's https://github.com/hashicorp/consul/blob/v1.6.3/agent/pool/pool.go#L468-L479 .
This commit is contained in:
Mahmood Ali
2020-02-03 12:41:11 -05:00
parent 82b8e086a5
commit 3bfc7d125d

View File

@@ -427,7 +427,6 @@ func (p *ConnPool) RPC(region string, addr net.Addr, version int, method string,
err = msgpackrpc.CallWithCodec(sc.codec, method, args, reply)
if err != nil {
sc.Close()
p.releaseConn(conn)
// If we read EOF, the session is toast. Clear it and open a
// new session next time
@@ -436,6 +435,8 @@ func (p *ConnPool) RPC(region string, addr net.Addr, version int, method string,
p.clearConn(conn)
}
p.releaseConn(conn)
// If the error is an RPC Coded error
// return the coded error without wrapping
if structs.IsErrRPCCoded(err) {