mirror of
https://github.com/gospider007/requests.git
synced 2025-12-24 13:57:52 +08:00
optimize code
This commit is contained in:
@@ -16,6 +16,7 @@ type Client struct {
|
||||
ctx context.Context
|
||||
cnl context.CancelFunc
|
||||
transport *roundTripper
|
||||
closed bool
|
||||
}
|
||||
|
||||
var defaultClient, _ = NewClient(nil)
|
||||
@@ -82,6 +83,7 @@ func (obj *Client) ForceCloseConns() {
|
||||
|
||||
// Close the client and cannot be used again after shutdown
|
||||
func (obj *Client) Close() {
|
||||
obj.closed = true
|
||||
obj.ForceCloseConns()
|
||||
obj.cnl()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user