Skip to content
Snippets Groups Projects
Commit c6c52cb9 authored by Xin.Zh's avatar Xin.Zh Committed by GitHub
Browse files

Merge pull request #183 from pantianying/fix_deadlock

Fix: gettyRPCClientPool.remove deadlock
parents 9abe968e b567742e
No related branches found
No related tags found
No related merge requests found
...@@ -275,6 +275,7 @@ func (p *gettyRPCClientPool) close() { ...@@ -275,6 +275,7 @@ func (p *gettyRPCClientPool) close() {
func (p *gettyRPCClientPool) getGettyRpcClient(protocol, addr string) (*gettyRPCClient, error) { func (p *gettyRPCClientPool) getGettyRpcClient(protocol, addr string) (*gettyRPCClient, error) {
p.Lock() p.Lock()
defer p.Unlock()
if p.conns == nil { if p.conns == nil {
return nil, errClientPoolClosed return nil, errClientPoolClosed
} }
...@@ -290,12 +291,9 @@ func (p *gettyRPCClientPool) getGettyRpcClient(protocol, addr string) (*gettyRPC ...@@ -290,12 +291,9 @@ func (p *gettyRPCClientPool) getGettyRpcClient(protocol, addr string) (*gettyRPC
continue continue
} }
conn.created = now //update created time conn.created = now //update created time
p.Unlock()
return conn, nil return conn, nil
} }
// create new conn // create new conn
p.Unlock()
return newGettyRPCClientConn(p, protocol, addr) 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