mirror of
https://github.com/go-gost/x.git
synced 2026-10-19 16:16:32 +00:00
fix(mtcp): re-init session in Handshake when it has no mux session yet
A session Dialed but not yet Handshaken has session.session == nil; a concurrent Dial treated it as dead (IsClosed() is true for nil sessions), deleted it and closed the base conn under the first caller's Handshake. Re-initializing on the nil-session case self-heals instead of failing the identity check.
This commit is contained in:
@@ -119,7 +119,7 @@ func (d *mtcpDialer) Handshake(ctx context.Context, conn net.Conn, options ...di
|
||||
session, ok := d.sessions[opts.Addr]
|
||||
if session != nil && session.conn != conn {
|
||||
conn.Close()
|
||||
return nil, errors.New("mtls: unrecognized connection")
|
||||
return nil, errors.New("mtcp: unrecognized connection")
|
||||
}
|
||||
|
||||
if !ok || session.session == nil {
|
||||
|
||||
Reference in New Issue
Block a user