Skip to content

Instantly share code, notes, and snippets.

@david7482
Last active July 29, 2021 18:09
Show Gist options
  • Save david7482/795c885185fb36c3ae6fb6c194fd7cdc to your computer and use it in GitHub Desktop.
Save david7482/795c885185fb36c3ae6fb6c194fd7cdc to your computer and use it in GitHub Desktop.
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