Last active
July 29, 2021 18:09
-
-
Save david7482/795c885185fb36c3ae6fb6c194fd7cdc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (p *http2clientConnPool) getClientConn(req *Request, addr string, dialOnMiss bool) (*http2ClientConn, error) { | |
// more codes | |
p.mu.Lock() | |
for _, cc := range p.conns[addr] { | |
if st := cc.idleState(); st.canTakeNewRequest { | |
p.mu.Unlock() | |
return cc, nil | |
} | |
} | |
// more codes | |
} | |
func (cc *http2ClientConn) idleState() http2clientConnIdleState { | |
cc.mu.Lock() | |
defer cc.mu.Unlock() | |
return cc.idleStateLocked() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment