Skip to content
Snippets Groups Projects
Commit c627227a authored by pantianying's avatar pantianying
Browse files

change the position of the lock

parent 32de4609
No related branches found
No related tags found
No related merge requests found
......@@ -291,8 +291,8 @@ func (p *gettyRPCClientPool) close() {
func (p *gettyRPCClientPool) getGettyRpcClient(protocol, addr string) (*gettyRPCClient, error) {
p.Lock()
defer p.Unlock()
if p.conns == nil {
p.Unlock()
return nil, errClientPoolClosed
}
......@@ -308,9 +308,10 @@ func (p *gettyRPCClientPool) getGettyRpcClient(protocol, addr string) (*gettyRPC
continue
}
conn.updateActive(now) //update active time
p.Unlock()
return conn, nil
}
p.Unlock()
// create new conn
return newGettyRPCClientConn(p, protocol, addr)
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment