Skip to content

Commit

Permalink
优化一下,新增一些状态
Browse files Browse the repository at this point in the history
  • Loading branch information
waterliu99 committed Nov 18, 2023
1 parent 5e19ace commit 9e3b6d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "7.0.203"
"version": "7.0.306"
}
}
12 changes: 11 additions & 1 deletion src/JT808.Gateway/JT808TcpServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ await Task.Factory.StartNew(async (state) =>
}
catch (OperationCanceledException)
{
break;
}
catch (ObjectDisposedException)
{
break;
}
catch (Exception)
{
Expand Down Expand Up @@ -310,8 +315,13 @@ public Task StopAsync(CancellationToken cancellationToken)
{
Logger.LogInformation("JT808 Tcp Server Stop");
if (server?.Connected ?? false)
server.Shutdown(SocketShutdown.Both);
server.Shutdown(SocketShutdown.Receive);
server?.Close();
server?.Dispose();
foreach (var item in SessionManager.Sessions)
{
item.Value.Client.Close();
}
return Task.CompletedTask;
}
}
Expand Down

0 comments on commit 9e3b6d3

Please sign in to comment.