Support receiving IPC messages in multiple parts

This commit is contained in:
patrick96 2021-09-12 23:26:24 +02:00 committed by Patrick Ziegler
parent dd4088910e
commit db52106934
6 changed files with 40 additions and 22 deletions
src/components

View file

@ -195,11 +195,6 @@ void controller::conn_cb(int status, int) {
}
}
void controller::ipc_cb(string buf) {
// TODO handle messages sent in multiple parts.
m_ipc->receive_message(buf);
}
void controller::signal_handler(int signum) {
m_log.notice("Received signal(%d): %s", signum, strsignal(signum));
stop(signum == SIGUSR1);
@ -264,7 +259,9 @@ void controller::read_events(bool confwatch) {
}
if (m_ipc) {
eloop->pipe_handle(m_ipc->get_file_descriptor(), [this](const string payload) { ipc_cb(payload); });
eloop->pipe_handle(
m_ipc->get_file_descriptor(), [this](const string payload) { m_ipc->receive_data(payload); },
[this]() { m_ipc->receive_eof(); });
}
if (!m_snapshot_dst.empty()) {