Fix compressed buffer not being emptied instantly in TcpPacketSocket::writeData

would only cause an issue when using sendAll, resulted in rarely not connecting
This commit is contained in:
Kae 2024-07-27 08:43:32 +10:00
parent 2d278e71c1
commit c3de15c18d

View File

@ -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());