fix: Fixes networking issues (#1958)
### Summary - Puts back `EventSink.SocketConnect`. - Reverts networking change to push the networking to a separate thread. - Reverts changes to the firewall by removing the firewall queue. - Fixes listeners not shutting down with the server. - Fixes race condition causing connections to get stuck even after they are disposed. > [!NOTE] > **Developer Note** > Networking has been reverted back to using the main thread instead of a background thread. This alleviated complexity and the requirement for concurrent queues all over the place.
This commit is contained in:
parent
97c53e656e
commit
e0fcde885c
10 changed files with 211 additions and 340 deletions
|
|
@ -16,7 +16,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using Server.Logging;
|
||||
|
||||
namespace Server.Network;
|
||||
|
|
@ -47,8 +46,8 @@ public static class PingServer
|
|||
return;
|
||||
}
|
||||
|
||||
HashSet<IPEndPoint> listeningAddresses = new HashSet<IPEndPoint>();
|
||||
List<UdpClient> listeners = new List<UdpClient>();
|
||||
HashSet<IPEndPoint> listeningAddresses = [];
|
||||
List<UdpClient> listeners = [];
|
||||
|
||||
foreach (var serverIpep in ServerConfiguration.Listeners)
|
||||
{
|
||||
|
|
@ -70,7 +69,7 @@ public static class PingServer
|
|||
}
|
||||
|
||||
listeners.Add(listener);
|
||||
new Thread(BeginAcceptingUdpRequest).Start(listener);
|
||||
BeginAcceptingUdpRequest(listener);
|
||||
}
|
||||
|
||||
foreach (var ipep in listeningAddresses)
|
||||
|
|
@ -140,4 +139,12 @@ public static class PingServer
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Shutdown()
|
||||
{
|
||||
foreach (var listener in Listeners)
|
||||
{
|
||||
listener.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue