This commit is contained in:
2026-07-17 02:19:05 +03:00
parent 4cd9f928ff
commit dbd5715578
42 changed files with 6000 additions and 866 deletions
+13 -3
View File
@@ -53,6 +53,13 @@ public abstract class NetworkServer<TConnection> : IDestructible where TConnecti
public event DestroyedEvent OnDestroy;
protected NetworkServer()
{
// Connection tracking is also used by externally hosted transports (for example,
// ASP.NET Core WebSockets) that don't create an ISocket listener through Start().
Connections = new AutoList<TConnection, NetworkServer<TConnection>>(this);
}
private void MinuteThread(object state)
{
@@ -93,8 +100,6 @@ public abstract class NetworkServer<TConnection> : IDestructible where TConnecti
if (listener != null)
return;
Connections = new AutoList<TConnection, NetworkServer<TConnection>>(this);
if (Timeout > 0 && Clock > 0)
{
timer = new Timer(MinuteThread, null, TimeSpan.FromMinutes(0), TimeSpan.FromSeconds(Clock));
@@ -273,7 +278,12 @@ public abstract class NetworkServer<TConnection> : IDestructible where TConnecti
finally
{
try { currentTimer?.Dispose(); } catch { }
Global.Log("NetworkServer", LogType.Warning, $"Server on port {port} is down.");
if (currentListener != null
|| currentTimer != null
|| (connections?.Length ?? 0) > 0)
{
Global.Log("NetworkServer", LogType.Debug, $"Server on port {port} is down.");
}
}
}