Skip to content

Commit

Permalink
fix ipc not writeable (#2466)
Browse files Browse the repository at this point in the history
Otherwise, clients get partial messages and this leads to invalid json.
  • Loading branch information
ammen99 authored Sep 7, 2024
1 parent e7c5139 commit 0aa1115
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/ipc/ipc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,11 @@ void wf::ipc::client_t::send_json(nlohmann::json json)
}

uint32_t len = serialized.length();
if (write_exact(fd, (char*)&len, 4))
if (!write_exact(fd, (char*)&len, 4) || !write_exact(fd, serialized.data(), len))
{
write_exact(fd, serialized.data(), len);
LOGE("Error sending json to client!");
shutdown(fd, SHUT_RDWR);
return;
}
}

Expand Down

0 comments on commit 0aa1115

Please sign in to comment.