Fix reset outbounds

This commit is contained in:
世界
2024-07-07 15:45:50 +08:00
parent 6144c8e340
commit 98ff897f35
13 changed files with 92 additions and 15 deletions

View File

@@ -72,12 +72,6 @@ func NewClient(ctx context.Context, dialer N.Dialer, serverAddr M.Socksaddr, opt
}, nil
}
func (c *Client) Close() error {
return common.Close(
common.PtrOrNil(c.conn),
)
}
func (c *Client) connect() (*grpc.ClientConn, error) {
conn := c.conn
if conn != nil && conn.GetState() != connectivity.Shutdown {
@@ -113,3 +107,13 @@ func (c *Client) DialContext(ctx context.Context) (net.Conn, error) {
}
return NewGRPCConn(stream, cancel), nil
}
func (c *Client) Close() error {
c.connAccess.Lock()
defer c.connAccess.Unlock()
if c.conn != nil {
c.conn.Close()
c.conn = nil
}
return nil
}