Skip to content

Commit

Permalink
pool: Clear connection before releasing
Browse files Browse the repository at this point in the history
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 .
  • Loading branch information
Mahmood Ali committed Feb 3, 2020
1 parent 82b8e08 commit 3bfc7d1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion helper/pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit 3bfc7d1

Please sign in to comment.