diff --git a/client.cpp b/client.cpp index 5bfcfec..a51d1d6 100644 --- a/client.cpp +++ b/client.cpp @@ -116,7 +116,8 @@ void Client::writePingResp() bool Client::writeBufIntoFd() { - std::lock_guard locker(writeBufMutex); + if (!writeBufMutex.try_lock()) + return true; int n; while ((n = write(fd, &writebuf[wri], getWriteBufBytesUsed())) != 0) @@ -142,6 +143,7 @@ bool Client::writeBufIntoFd() setReadyForWriting(false); } + writeBufMutex.unlock(); return true; }