diff --git a/protocol/dubbo/pool.go b/protocol/dubbo/pool.go index 6a5a62bd96be8ab8dc92c155ebc07ca0d37a8bb6..b5bf040c67c2e0071222466e59db4de67d9e1ca2 100644 --- a/protocol/dubbo/pool.go +++ b/protocol/dubbo/pool.go @@ -289,13 +289,15 @@ func (p *gettyRPCClientPool) close() { } func (p *gettyRPCClientPool) getGettyRpcClient(protocol, addr string) (*gettyRPCClient, error) { - if conn, err := p.selectGettyRpcClient(protocol, addr); err != nil { - return nil, err - } else if conn != nil { - return conn, nil + var ( + conn *gettyRPCClient + err error + ) + if conn, err = p.selectGettyRpcClient(protocol, addr); err == nil && conn == nil { + // create new conn + return newGettyRPCClientConn(p, protocol, addr) } - // create new conn - return newGettyRPCClientConn(p, protocol, addr) + return conn, err } func (p *gettyRPCClientPool) selectGettyRpcClient(protocol, addr string) (*gettyRPCClient, error) { p.Lock()