Skip to content

Commit

Permalink
start middlewares when server starts
Browse files Browse the repository at this point in the history
  • Loading branch information
kerryjiang committed Aug 30, 2024
1 parent 8892e9f commit 1d399c1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/SuperSocket.Server/SuperSocketService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,6 @@ private void InitializeMiddlewares()
_middlewares = _serviceProvider.GetServices<IMiddleware>()
.OrderBy(m => m.Order)
.ToArray();

foreach (var m in _middlewares)
{
m.Start(this);
}
}

private void ShutdownMiddlewares()
Expand Down Expand Up @@ -452,6 +447,11 @@ public async Task StartAsync(CancellationToken cancellationToken)

_state = ServerState.Starting;

foreach (var m in _middlewares)
{
m.Start(this);
}

if (!await StartListenAsync(cancellationToken))
{
_state = ServerState.Failed;
Expand Down

0 comments on commit 1d399c1

Please sign in to comment.