Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarNetPacketSocket.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-07-27 08:43:32 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2024-07-27 08:43:32 +1000
commitc3de15c18d2720c166e71738d120849630ba8747 (patch)
tree5020475ec95a9f74ff02bb5342aa6920d2eefe66 /source/game/StarNetPacketSocket.cpp
parent2d278e71c15c739a7c9f68e7823ccf3bb7698819 (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.cpp14
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());