Skip to content

Commit c0bdad1

Browse files
committed
added SIGTERM handling so quit when docker asks
1 parent 470edf4 commit c0bdad1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/RServer.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ RServer::RServer()
2929
event_config_require_features(config, EV_FEATURE_FDS);
3030
_eventBase = event_base_new_with_config(config);
3131
event_config_free(config);
32-
33-
event_new(_eventBase, SIGINT, EV_SIGNAL|EV_PERSIST, terminate_app, this);
32+
//add signal handler event for basic kill signal
33+
auto evt = event_new(_eventBase, SIGTERM, EV_SIGNAL|EV_PERSIST, terminate_app, this);
34+
event_add(evt, nullptr);
3435
}
3536

3637
RServer::~RServer()
@@ -68,8 +69,9 @@ RServer::startRunLoop()
6869
}
6970
event_add(listener_event, nullptr);
7071

72+
cerr << "listening" << endl;
73+
7174
int drc = event_base_dispatch(_eventBase);
72-
cerr << "dispatch:" << drc << endl;
7375
}
7476

7577
void
@@ -149,4 +151,4 @@ event_callback(evutil_socket_t socket, short events, void *objptr)
149151
{
150152
RServer *server = static_cast<RServer*>(objptr);
151153
server->handleEvent(socket, events);
152-
}
154+
}

0 commit comments

Comments
 (0)