From 8e42d0c1b7ae36cff2e7c69999117911a4b6f300 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期四, 26 三月 2026 17:31:06 +0800
Subject: [PATCH] feat(WCS): 完善 WIDESEAWCS_Tasks 模块代码注释
---
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SocketServer/TcpSocketServer.Dispose.cs | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SocketServer/TcpSocketServer.Dispose.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SocketServer/TcpSocketServer.Dispose.cs
index 539df48..94c439e 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SocketServer/TcpSocketServer.Dispose.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SocketServer/TcpSocketServer.Dispose.cs
@@ -6,17 +6,28 @@
public partial class TcpSocketServer
{
/// <summary>
- /// 释放服务器使用的所有资源并停止监听传入连接。
+ /// 閲婃斁鏈嶅姟鍣ㄨ祫婧�
/// </summary>
- /// <remarks>当不再需要服务器时调用此方法,以确保所有相关资源(如网络监听器和同步原语)被正确释放。
- /// 调用 <see cref="Dispose"/> 后,服务器无法重新启动或再次使用。</remarks>
+ /// <remarks>
+ /// 鍋滄鐩戝惉銆佸彇娑堟墍鏈夊鎴风浠诲姟銆佸叧闂洃鍚櫒銆侀噴鏀句俊鍙烽噺銆�
+ /// 璋冪敤姝ゆ柟娉曞悗锛屾湇鍔″櫒鏃犳硶鍐嶆浣跨敤銆�
+ /// </remarks>
public void Dispose()
{
+ // 鍙栨秷鎵�鏈夋搷浣�
_cts?.Cancel();
+
+ // 鍋滄鐩戝惉鍣�
_listener?.Stop();
+
+ // 閲婃斁鍙栨秷浠ょ墝婧�
_cts?.Dispose();
+
+ // 閲婃斁鎵�鏈夊鎴风淇″彿閲�
foreach (var sem in _clientLocks.Values) { try { sem.Dispose(); } catch { } }
_clientLocks.Clear();
+
+ // 璁板綍鍋滄鏃ュ織
Log($"[{DateTime.Now}] TcpSocketServer stopped");
}
}
--
Gitblit v1.9.3