Auto calling of connection::prepare_to_event_handling

This commit is contained in:
Sergey Naumov
2016-09-05 20:55:33 +03:00
parent 4065f549c2
commit 19b460851b
3 changed files with 4 additions and 10 deletions

View File

@@ -329,9 +329,10 @@ void connection::prepare_to_event_handling() {
m_event_socket = i3_connect(m_socket_path);
this->subscribe(m_subscriptions);
}
void connection::handle_event() {
if (m_event_socket <= 0) {
throw std::runtime_error("event_socket_fd <= 0");
this->prepare_to_event_handling();
}
auto buf = i3_recv(m_event_socket);