From: AeonLucid Date: Sat, 24 Oct 2020 02:38:14 +0000 (+0200) Subject: Use LongRunning tasks for the server and client X-Git-Tag: v1.2.2~96^2~23 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=96c2647193387caa939a241935ff3418f62083ab;p=rhonda%2Fimpostor.git Use LongRunning tasks for the server and client --- diff --git a/src/Impostor.Hazel/Udp/UdpClientConnection.cs b/src/Impostor.Hazel/Udp/UdpClientConnection.cs index f163e5b..4f81177 100644 --- a/src/Impostor.Hazel/Udp/UdpClientConnection.cs +++ b/src/Impostor.Hazel/Udp/UdpClientConnection.cs @@ -114,7 +114,7 @@ namespace Impostor.Hazel.Udp try { - _listenTask = ListenAsync(); + _listenTask = Task.Factory.StartNew(ListenAsync, TaskCreationOptions.LongRunning); } catch (ObjectDisposedException) { diff --git a/src/Impostor.Hazel/Udp/UdpConnection.cs b/src/Impostor.Hazel/Udp/UdpConnection.cs index 7227dba..fbd74b7 100644 --- a/src/Impostor.Hazel/Udp/UdpConnection.cs +++ b/src/Impostor.Hazel/Udp/UdpConnection.cs @@ -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) diff --git a/src/Impostor.Hazel/Udp/UdpConnectionListener.cs b/src/Impostor.Hazel/Udp/UdpConnectionListener.cs index a2b6180..f00f98f 100644 --- a/src/Impostor.Hazel/Udp/UdpConnectionListener.cs +++ b/src/Impostor.Hazel/Udp/UdpConnectionListener.cs @@ -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) diff --git a/src/Impostor.Tools.ServerReplay/Program.cs b/src/Impostor.Tools.ServerReplay/Program.cs index 424a7bf..8ae8bfa 100644 --- a/src/Impostor.Tools.ServerReplay/Program.cs +++ b/src/Impostor.Tools.ServerReplay/Program.cs @@ -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.