|
|
@@ -46,8 +46,7 @@ namespace JT808.DotNetty.Tcp.Handlers |
|
|
|
string channelId = context.Channel.Id.AsShortText(); |
|
|
|
if (logger.IsEnabled(LogLevel.Debug)) |
|
|
|
logger.LogDebug($">>>{ channelId } The client disconnects from the server."); |
|
|
|
jT808SessionManager.RemoveSessionByChannel(context.Channel); |
|
|
|
base.ChannelInactive(context); |
|
|
|
base.CloseAsync(context); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
@@ -81,7 +80,6 @@ namespace JT808.DotNetty.Tcp.Handlers |
|
|
|
string channelId = context.Channel.Id.AsShortText(); |
|
|
|
logger.LogInformation($"{idleStateEvent.State.ToString()}>>>{channelId}"); |
|
|
|
// 由于808是设备发心跳,如果很久没有上报数据,那么就由服务器主动关闭连接。 |
|
|
|
jT808SessionManager.RemoveSessionByChannel(context.Channel); |
|
|
|
context.CloseAsync(); |
|
|
|
} |
|
|
|
// 按照808的消息,有些请求必须要应答,但是转发可以不需要有应答可以节省部分资源包括: |
|
|
@@ -97,7 +95,6 @@ namespace JT808.DotNetty.Tcp.Handlers |
|
|
|
{ |
|
|
|
string channelId = context.Channel.Id.AsShortText(); |
|
|
|
logger.LogError(exception,$"{channelId} {exception.Message}" ); |
|
|
|
jT808SessionManager.RemoveSessionByChannel(context.Channel); |
|
|
|
context.CloseAsync(); |
|
|
|
} |
|
|
|
} |
|
|
|