fix(i3): Reconnect i3 IPC socket on restart/error (#762)

This commit is contained in:
Jan Holthuis 2018-03-15 15:55:38 +01:00 committed by Patrick Ziegler
parent 55331d17f7
commit a2ce4ed725
1 changed files with 7 additions and 0 deletions

View File

@ -102,6 +102,13 @@ namespace modules {
m_ipc->handle_event();
return true;
} catch (const exception& err) {
try {
m_log.warn("%s: Attempting to reconnect socket (reason: %s)", name(), err.what());
m_ipc->connect_event_socket(true);
m_log.info("%s: Reconnecting socket succeeded", name());
} catch (const exception& err) {
m_log.err("%s: Failed to reconnect socket (reason: %s)", name(), err.what());
}
return false;
}
}