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

@@ -97,5 +97,15 @@ func (c *Client) DialContext(ctx context.Context) (net.Conn, error) {
}
func (c *Client) Close() error {
return common.Close(c.conn, c.rawConn)
c.connAccess.Lock()
defer c.connAccess.Unlock()
if c.conn != nil {
c.conn.CloseWithError(0, "")
}
if c.rawConn != nil {
c.rawConn.Close()
}
c.conn = nil
c.rawConn = nil
return nil
}