增加TCP 客户端主动关闭监听

This commit is contained in:
zenghongyao 2025-05-18 17:18:31 +08:00
parent 9603b02532
commit 070173af4f

View File

@ -16,7 +16,7 @@ using Volo.Abp.Domain.Repositories;
namespace JiShe.CollectBus.Plugins
{
public partial class TcpMonitor : PluginBase, ITransientDependency, ITcpReceivedPlugin, ITcpConnectingPlugin, ITcpConnectedPlugin, ITcpClosedPlugin
public partial class TcpMonitor : PluginBase, ITransientDependency, ITcpReceivedPlugin, ITcpConnectingPlugin, ITcpConnectedPlugin, ITcpClosedPlugin, ITcpClosingPlugin
{
private readonly IProducerService _producerService;
private readonly ILogger<TcpMonitor> _logger;
@ -115,5 +115,11 @@ namespace JiShe.CollectBus.Plugins
await e.InvokeNext();
}
public Task OnTcpClosing(ITcpSession client, ClosingEventArgs e)
{
var tcpSessionClient = (ITcpSessionClient)client;
_logger.LogWarning($"[TCP] ID:{tcpSessionClient.Id} IP:{client.GetIPPort()}终端主动关闭");
return Task.CompletedTask;
}
}
}