If shutdown starts (e.g. `AsioTransportLayer::stopAcceptingSessions`) before `_runListener` initially acquires the lock, the server would deadlock because `_runListener` would change the listener state from `kShuttingDown` to `kActive` after `_startListening` returned, so would never get out of the while loop, and `stopAcceptingSessions` would be stuck when it attempts to join the listener thread. Not switching the state to `kActive` if it is already `kShuttingDown` fixes the issue. There's no race condition here since the state is guarded by `_mutex`.
Don't start listening for connections if already shutting down
- Assignee:
-
Michael Nugent
- Reporter:
-
Michael Nugent
- Votes:
-
0 Vote for this issue - Watchers:
-
3 Start watching this issue
- Created:
- Updated:
- Resolved: