optimize code

This commit is contained in:
bxd
2023-12-02 16:51:46 +08:00
parent 36a4432d71
commit 90356e076c
12 changed files with 316 additions and 213 deletions

View File

@@ -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()
}