quic: fix premature unref of endpoint when listening

Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/63267
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
James M Snell committed 2026-05-21 14:16:49 -07:00
1 parent b621fb3a18
commit 5d1ea79a83
1 file changed
+3 -1
+3 -1
View File
@@ -735,7 +735,9 @@ void Endpoint::RemoveSession(const CID& cid,
}
}
if (primary_session_count_ > 0 && --primary_session_count_ == 0) {
udp_.Unref();
if (!is_listening()) {
udp_.Unref();
}
session_manager().RemoveSession(cid);
// The endpoint may be idle (no sessions, not listening). MaybeDestroy
// handles both closing (immediate destroy) and idle timeout (start