add CanTakeNewRequest function on ClientConn

merge_conn
fangdingjun 6 years ago
parent 10c9e2bbab
commit 994f455368

@ -358,6 +358,22 @@ func (c *ClientConn) CreateRequest(req *http.Request) (*http.Response, error) {
//return nil, fmt.Errorf("unknown error") //return nil, fmt.Errorf("unknown error")
} }
// CanTakeNewRequest check if the ClientConn can submit a new request
func (c *ClientConn) CanTakeNewRequest() bool {
if c.closed {
return false
}
if c.err != nil {
return false
}
if c.streamCount > ((1 << 31) / 2) {
return false
}
return true
}
// ServerConn server connection // ServerConn server connection
type ServerConn struct { type ServerConn struct {
// Handler handler to handle request // Handler handler to handle request

Loading…
Cancel
Save