chore: better safeConnClose

This commit is contained in:
wwqgtxx
2022-12-16 22:15:44 +08:00
parent 432c4c2cf1
commit 57592ee840
8 changed files with 18 additions and 18 deletions

View File

@ -238,9 +238,9 @@ func (v *Vmess) DialContext(ctx context.Context, metadata *C.Metadata, opts ...d
return nil, fmt.Errorf("%s connect error: %s", v.addr, err.Error())
}
tcpKeepAlive(c)
defer func() {
defer func(c net.Conn) {
safeConnClose(c, err)
}()
}(c)
c, err = v.StreamConn(c, metadata)
return NewConn(c, v), err