diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-07-27 08:43:32 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-07-27 08:43:32 +1000 |
commit | c3de15c18d2720c166e71738d120849630ba8747 (patch) | |
tree | 5020475ec95a9f74ff02bb5342aa6920d2eefe66 /source/game/StarNetPacketSocket.cpp | |
parent | 2d278e71c15c739a7c9f68e7823ccf3bb7698819 (diff) |
Fix compressed buffer not being emptied instantly in TcpPacketSocket::writeData
would only cause an issue when using sendAll, resulted in rarely not connecting
Diffstat (limited to 'source/game/StarNetPacketSocket.cpp')
-rw-r--r-- | source/game/StarNetPacketSocket.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source/game/StarNetPacketSocket.cpp b/source/game/StarNetPacketSocket.cpp index 7a0724b..cd5c749 100644 --- a/source/game/StarNetPacketSocket.cpp +++ b/source/game/StarNetPacketSocket.cpp @@ -285,12 +285,14 @@ bool TcpPacketSocket::writeData() { m_outputBuffer.clear(); m_compressedBuffer.append(compressed.ptr(), compressed.size()); - size_t written = m_socket->send(m_compressedBuffer.ptr(), m_compressedBuffer.size()); - if (written > 0) { - dataSent = true; - m_compressedBuffer.trimLeft(written); - m_outgoingStats.mix(written); - } + do { + size_t written = m_socket->send(m_compressedBuffer.ptr(), m_compressedBuffer.size()); + if (written > 0) { + dataSent = true; + m_compressedBuffer.trimLeft(written); + m_outgoingStats.mix(written); + } + } while (!m_compressedBuffer.empty()); } else { do { size_t written = m_socket->send(m_outputBuffer.ptr(), m_outputBuffer.size()); |