]> git.deb.at Git - rhonda/impostor.git/commitdiff
Use LongRunning tasks for the server and client
authorAeonLucid <aeonlucid@outlook.com>
Sat, 24 Oct 2020 02:38:14 +0000 (04:38 +0200)
committerAeonLucid <aeonlucid@outlook.com>
Sat, 24 Oct 2020 02:38:14 +0000 (04:38 +0200)
src/Impostor.Hazel/Udp/UdpClientConnection.cs
src/Impostor.Hazel/Udp/UdpConnection.cs
src/Impostor.Hazel/Udp/UdpConnectionListener.cs
src/Impostor.Tools.ServerReplay/Program.cs

index f163e5b0b4a5a14eba64f5e55c702d86557702c5..4f8117787c4c035eb3cd8f0cceb3f48db4504427 100644 (file)
@@ -114,7 +114,7 @@ namespace Impostor.Hazel.Udp
 
             try
             {
-                _listenTask = ListenAsync();
+                _listenTask = Task.Factory.StartNew(ListenAsync, TaskCreationOptions.LongRunning);
             }
             catch (ObjectDisposedException)
             {
index 7227dba8a36af06d5822492b6d4591b17e6d549e..fbd74b7bf8deac06e0f7d195a2d3e63a29a83874 100644 (file)
@@ -40,7 +40,7 @@ namespace Impostor.Hazel.Udp
         public Task StartAsync()
         {
             // Store the task we're executing
-            _executingTask = ReadAsync();
+            _executingTask = Task.Factory.StartNew(ReadAsync, TaskCreationOptions.LongRunning);
 
             // If the task is completed then return it, this will bubble cancellation and failure to the caller
             if (_executingTask.IsCompleted)
index a2b618032539ef914d9cd029c39b053c637a9b53..f00f98fbc82be3f229e3449b1b440b9c6353b62e 100644 (file)
@@ -84,7 +84,7 @@ namespace Impostor.Hazel.Udp
         public override Task StartAsync()
         {
             // Store the task we're executing
-            _executingTask = ListenAsync();
+            _executingTask = Task.Factory.StartNew(ListenAsync, TaskCreationOptions.LongRunning);
 
             // If the task is completed then return it, this will bubble cancellation and failure to the caller
             if (_executingTask.IsCompleted)
index 424a7bf4d3eec2c6bc1128bdaf94bbae45a02589..8ae8bfa2b911749751b8fd961c8853b87d224d37 100644 (file)
@@ -125,7 +125,7 @@ namespace Impostor.Tools.ServerReplay
                     var addressLength = reader.ReadByte();
                     var addressBytes = reader.ReadBytes(addressLength);
                     var addressPort = reader.ReadUInt16();
-                    var address = new IPEndPoint(new IPAddress(addressBytes), clientId);
+                    var address = new IPEndPoint(new IPAddress(addressBytes), addressPort);
                     var name = reader.ReadString();
 
                     // Create and register connection.