From 5cb1ed3b427db3e23ed88fe1c38288c19c420c8d Mon Sep 17 00:00:00 2001 From: Arkady Date: Sun, 8 Dec 2024 03:20:18 +0300 Subject: [PATCH] probable race condition?.. --- source/NetCoreServer/TcpSession.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/NetCoreServer/TcpSession.cs b/source/NetCoreServer/TcpSession.cs index 7d01cce..71d960b 100644 --- a/source/NetCoreServer/TcpSession.cs +++ b/source/NetCoreServer/TcpSession.cs @@ -338,16 +338,16 @@ public virtual bool SendAsync(ReadOnlySpan buffer) // Update statistic BytesPending = _sendBufferMain.Size; - - // Avoid multiple send handlers - if (_sending) - return true; - else - _sending = true; - - // Try to send the main buffer - TrySend(); } + + // Avoid multiple send handlers + if (_sending) + return true; + + _sending = true; + + // Try to send the main buffer + TrySend(); return true; }