0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 12:12:15 +02:00

omi\openvpn.cpp: cancel wait on exit event

When OMI is stopped, we must cancel wait on
exit event, otherwise ASIO won't terminate event loop
and process won't exit.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
This commit is contained in:
Lev Stipakov 2020-02-28 16:12:43 +02:00 committed by David Sommerseth
parent 516b32c2b8
commit aaafb33d30
No known key found for this signature in database
GPG Key ID: 86CF944C9671FDF2

View File

@ -125,9 +125,12 @@ public:
if (!exit_event_name.empty()) if (!exit_event_name.empty())
{ {
exit_event.assign(::CreateEvent(NULL, FALSE, FALSE, exit_event_name.c_str())); exit_event.assign(::CreateEvent(NULL, FALSE, FALSE, exit_event_name.c_str()));
exit_event.async_wait([self = Ptr(this)](const openvpn_io::error_code& error) { exit_event.async_wait([self = Ptr(this)](const openvpn_io::error_code& error)
self->stop(); {
}); if (error)
return;
self->stop();
});
} }
// http-proxy-override // http-proxy-override
@ -641,6 +644,10 @@ private:
// in case connect thread is blocking in external_pki_sign_request // in case connect thread is blocking in external_pki_sign_request
async_stop.stop(); async_stop.stop();
// cancel wait on exit_event
if (exit_event.is_open())
exit_event.cancel();
// stop timers // stop timers
reconnect_timer.cancel(); reconnect_timer.cancel();
bytecount_timer.cancel(); bytecount_timer.cancel();