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) {