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

Replace AsioTimer with AsioTimerSafe in cases where handler doesn't clearly check for late cancellation

As noted in the Asio documentation, an AsioTimer handler can be
called with a non-error status after timer cancellation.

Unfortunately, this can lead to race conditions, so I'm moving over
all AsioTimer users to AsioTimerSafe when I don't see the handler
clearly checking for late cancellation.

Signed-off-by: James Yonan <james@openvpn.net>
This commit is contained in:
James Yonan 2019-08-30 01:39:29 -06:00 committed by Lev Stipakov
parent ac158fd0bf
commit 80e754d00a
No known key found for this signature in database
GPG Key ID: 88670BE258B9C258

View File

@ -27,7 +27,7 @@
#include <openvpn/common/options.hpp>
#include <openvpn/buffer/bufstr.hpp>
#include <openvpn/time/timestr.hpp>
#include <openvpn/time/asiotimer.hpp>
#include <openvpn/time/asiotimersafe.hpp>
#include <openvpn/asio/asiowork.hpp>
// include acceptors for different protocols
@ -977,7 +977,7 @@ namespace openvpn {
// stopping
volatile bool stop_called = false;
AsioTimer stop_timer;
AsioTimerSafe stop_timer;
// hold
bool hold_wait = false;