From 59ba0ece7f1f316dba0ff0232314608eadb78542 Mon Sep 17 00:00:00 2001 From: Timothy Schenk Date: Fri, 27 Oct 2023 18:16:26 +0200 Subject: [PATCH] fix: fire and forget aka double start of Task --- Server/AuthSession.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Server/AuthSession.cs b/Server/AuthSession.cs index 7b0d1cd..bdc3168 100644 --- a/Server/AuthSession.cs +++ b/Server/AuthSession.cs @@ -88,8 +88,7 @@ public class AuthSession : TcpSession var rawPacket = new RawPacket((OperationCode)opCode, dataBuffer, clientAliveTime, buffer[7], buffer[4], this.Id, this); - var thread = new Thread(() => this.mediator.Send(rawPacket).Start()) { IsBackground = true }; - thread.Start(); + _ = this.mediator.Send(rawPacket); this.logger.LogInformation("Connection from: {@RemoteEndpoint}", this.Socket.RemoteEndPoint?.ToString()); base.OnReceived(decryptedBuffer.ToArray(), offset, decryptedBuffer.Length);