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

fix deadlock

parent 79f482ce
No related branches found
No related tags found
No related merge requests found
......@@ -275,6 +275,7 @@ func (p *gettyRPCClientPool) close() {
func (p *gettyRPCClientPool) getGettyRpcClient(protocol, addr string) (*gettyRPCClient, error) {
p.Lock()
defer p.Unlock()
if p.conns == nil {
return nil, errClientPoolClosed
}
......@@ -290,12 +291,10 @@ func (p *gettyRPCClientPool) getGettyRpcClient(protocol, addr string) (*gettyRPC
continue
}
conn.created = now //update created time
p.Unlock()
return conn, nil
}
// create new conn
p.Unlock()
return newGettyRPCClientConn(p, protocol, addr)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment