diff options
author | Gyuhwan Park <unstabler@unstabler.pl> | 2022-05-28 11:52:40 +0300 |
---|---|---|
committer | Gyuhwan Park <unstabler@unstabler.pl> | 2022-05-28 12:08:56 +0300 |
commit | 11372faa40dd48cd44d8bc891cdfd06d00458931 (patch) | |
tree | 286a49834973594daba167d0369ff61ef4d6e165 | |
parent | 0c5ffd7159b5f88878ec17d8bb19157aa960b1b6 (diff) |
fix(IPCConnection): do not throw exception even write() has failed
-rw-r--r-- | IPCConnection.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/IPCConnection.cpp b/IPCConnection.cpp index 3da91c4..fd50dd1 100644 --- a/IPCConnection.cpp +++ b/IPCConnection.cpp @@ -91,15 +91,17 @@ void IPCConnection::workerLoop() { bool canWrite = (pollFd.revents & POLLOUT) > 0; if (canWrite && !_writeTasks.empty()) { - auto writeTask = std::move(_writeTasks.front()); + auto &writeTask = _writeTasks.front(); + if (_socket.write(writeTask.second.get(), writeTask.first) < 0) { if (errno == EAGAIN) { continue; } - - throw SystemCallException(errno, "write"); + + LOG(LOG_LEVEL_ERROR, "write() failed (errno=%d)", errno); + continue; } - + { std::scoped_lock<std::mutex> scopedWriteTasksLock(_writeTasksLock); _writeTasks.pop(); |