fix(workspaces): avoid mutex block

This commit is contained in:
Alex
2019-04-19 12:11:55 +02:00
parent 171ecd53aa
commit e77c155ede
3 changed files with 43 additions and 33 deletions

View File

@ -77,11 +77,11 @@ struct Ipc::ipc_response Ipc::recv(int fd) const {
while (total < ipc_header_size_) {
auto res = ::recv(fd, header.data() + total, ipc_header_size_ - total, 0);
if (fd_event_ == -1 || fd_ == -1) {
// IPC is closed so just return an empty response
return {0, 0, ""};
}
if (res <= 0) {
if (res <= 0 && (fd_event_ == -1 || fd_ == -1)) {
// IPC is closed so just return an empty response
return {0, 0, ""};
}
throw std::runtime_error("Unable to receive IPC header");
}
total += res;