Fix http2 transport close
This commit is contained in:
@@ -167,3 +167,8 @@ func (c *Client) dialHTTP2(ctx context.Context) (net.Conn, error) {
|
||||
}()
|
||||
return conn, nil
|
||||
}
|
||||
|
||||
func (c *Client) Close() error {
|
||||
CloseIdleConnections(c.transport)
|
||||
return nil
|
||||
}
|
||||
|
||||
13
transport/v2rayhttp/pool.go
Normal file
13
transport/v2rayhttp/pool.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package v2rayhttp
|
||||
|
||||
import "net/http"
|
||||
|
||||
type ConnectionPool interface {
|
||||
CloseIdleConnections()
|
||||
}
|
||||
|
||||
func CloseIdleConnections(transport http.RoundTripper) {
|
||||
if connectionPool, ok := transport.(ConnectionPool); ok {
|
||||
connectionPool.CloseIdleConnections()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user