Skip to content

Commit

Permalink
fixed a bug in service dispose
Browse files Browse the repository at this point in the history
  • Loading branch information
kerryjiang committed Jan 26, 2025
1 parent 2028d16 commit 1f910e5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/SuperSocket.Server/SuperSocketService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,11 @@ protected virtual async ValueTask DisposeAsync(bool disposing)
_logger.LogError(e, "Failed to stop the server");
}

if (_connectionListeners.Any())
var connectionListeners = _connectionListeners;

if (connectionListeners != null && connectionListeners.Any())
{
foreach (var listener in _connectionListeners)
foreach (var listener in connectionListeners)
{
listener.Dispose();
}
Expand Down

0 comments on commit 1f910e5

Please sign in to comment.