Commit c98ab7afb3393b1c7034661ed57b65b525000d0d

Authored by Wiebe Cazemier
1 parent d363f229

Fix forgotten lock on write buffer reset

Showing 1 changed file with 3 additions and 0 deletions
client.cpp
@@ -309,6 +309,9 @@ std::string Client::getKeepAliveInfoString() const @@ -309,6 +309,9 @@ std::string Client::getKeepAliveInfoString() const
309 void Client::resetBuffersIfEligible() 309 void Client::resetBuffersIfEligible()
310 { 310 {
311 readbuf.resetSizeIfEligable(initialBufferSize); 311 readbuf.resetSizeIfEligable(initialBufferSize);
  312 +
  313 + // Write buffers are written to from other threads, and this resetting takes place from the Client's own thread, so we need to lock.
  314 + std::lock_guard<std::mutex> locker(writeBufMutex);
312 writebuf.resetSizeIfEligable(initialBufferSize); 315 writebuf.resetSizeIfEligable(initialBufferSize);
313 } 316 }
314 317