wpipc fixes
This MR fixes several issues with the wpipc
library and its unit tests:
- Currently, the
/wpipc/sender-lost-connection
unit test is racy because the lost connection handler can be triggered more than once, emitting more than 1 expected event in the unit test. This is a bug in the wpipc library because the sender was not disconnecting when failing to read the reply from the server. This MR fixes this by always disconnecting the sender when the connection is lost, fixing the possible race condition in the unit test. - The wpipc unit tests use now a conditional variable instead of a while loop to wait for events. This also fixes possible hanging issues if running the unit tests with valgrind because
g_cond_wait
gives priorities to other threads while waiting. - The protocol API now always initializes the buffer to 0 before building a reply or request, fixing valgrind uninitialized memory errors when running the unit tests.