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:
ginuerzh
2026-09-06 00:17:10 +08:00
parent fe9d9c9574
commit 967053c690
+1 -1
View File
@@ -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 {