Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/core/listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
#include "listener.c.clog.h"
#endif

_IRQL_requires_max_(PASSIVE_LEVEL)
void
QuicListenerStopAsync(
_In_ QUIC_LISTENER* Listener
);

BOOLEAN
QuicListenerIsOnWorker(
_In_ QUIC_LISTENER* Listener
Expand Down
9 changes: 9 additions & 0 deletions src/core/listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,12 @@ BOOLEAN
QuicListenerDrainOperations(
_In_ QUIC_LISTENER* Listener
);

//
// Stops the listener asynchronously.
//
_IRQL_requires_max_(PASSIVE_LEVEL)
void
QuicListenerStopAsync(
_In_ QUIC_LISTENER* Listener
);
31 changes: 26 additions & 5 deletions src/core/registration.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,14 +395,35 @@ MsQuicRegistrationShutdown(
Entry = Entry->Flink;
}

CxPlatDispatchLockRelease(&Registration->ConnectionLock);
//
// Drain listeners under the registration lock into a local list while
// taking a non-zero cleanup reference on each one. Then stop them outside
Comment thread
Santhosha-bk marked this conversation as resolved.
Outdated
// the lock.
//
CXPLAT_LIST_ENTRY PendingListeners;
CxPlatListInitializeHead(&PendingListeners);

Entry = Registration->Listeners.Flink;
while (Entry != &Registration->Listeners) {
while (!CxPlatListIsEmpty(&Registration->Listeners)) {
Entry = CxPlatListRemoveHead(&Registration->Listeners);
QUIC_LISTENER* Listener =
CXPLAT_CONTAINING_RECORD(Entry, QUIC_LISTENER, RegistrationLink);
Entry = Entry->Flink;
MsQuicListenerStop((HQUIC)Listener);

if (CxPlatRefIncrementNonZero(&Listener->RefCount, 1)) {
CxPlatListInsertTail(&PendingListeners, &Listener->RegistrationLink);
}
}

CxPlatDispatchLockRelease(&Registration->ConnectionLock);

while (!CxPlatListIsEmpty(&PendingListeners)) {
QUIC_LISTENER* Listener =
CXPLAT_CONTAINING_RECORD(
CxPlatListRemoveHead(&PendingListeners),
QUIC_LISTENER,
RegistrationLink);

QuicListenerStopAsync(Listener);
QuicListenerRelease(Listener);
}
}

Expand Down
Loading