From db1fe40f90101ca3315010d7abe2319ad4ac7342 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 5 Aug 2017 13:24:07 +1000 Subject: [PATCH] X --- MCGalaxy/Network/Socket/TcpSocket.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/MCGalaxy/Network/Socket/TcpSocket.cs b/MCGalaxy/Network/Socket/TcpSocket.cs index 1d7e6bcfe..7e06bfc15 100644 --- a/MCGalaxy/Network/Socket/TcpSocket.cs +++ b/MCGalaxy/Network/Socket/TcpSocket.cs @@ -111,8 +111,11 @@ namespace MCGalaxy.Network { } lock (sendLock) { - if (sendInProgress) { sendQueue.Enqueue(buffer); } - else { DoSendAsync(buffer); } + if (sendInProgress) { + sendQueue.Enqueue(buffer); + } else { + if (!DoSendAsync(buffer)) sendInProgress = false; + } } } catch (SocketException) { player.Disconnect(); @@ -152,6 +155,8 @@ namespace MCGalaxy.Network { // DoSendAsync returns false if SendAsync completed sync // If that happens, SendCallback isn't called so we need to send data here instead if (s.DoSendAsync(s.sendQueue.Dequeue())) return; + + if (s.player.disconnected) s.sendQueue.Clear(); } } } catch (SocketException) {