OpenVPN 3 Core Library
Loading...
Searching...
No Matches
waitbarrier.hpp
Go to the documentation of this file.
1// OpenVPN -- An application to securely tunnel IP networks
2// over a single port, with support for SSL/TLS-based
3// session authentication and key exchange,
4// packet encryption, packet authentication, and
5// packet compression.
6//
7// Copyright (C) 2012- OpenVPN Inc.
8//
9// SPDX-License-Identifier: MPL-2.0 OR AGPL-3.0-only WITH openvpn3-openssl-exception
10//
11
12#ifndef OPENVPN_COMMON_WAITBARRIER_H
13#define OPENVPN_COMMON_WAITBARRIER_H
14
17
18namespace openvpn {
19
20#ifdef INSTRUMENTATION_SLOWDOWN
21static constexpr unsigned int WAIT_BARRIER_TIMEOUT = 300;
22#else
23static constexpr unsigned int WAIT_BARRIER_TIMEOUT = 30;
24#endif
25
26template <typename THREAD_COMMON>
27inline void event_loop_wait_barrier(THREAD_COMMON &tc,
28 const unsigned int seconds = WAIT_BARRIER_TIMEOUT)
29{
30 // barrier prior to event-loop entry
31 switch (tc.event_loop_bar.wait(seconds))
32 {
34 break;
36 tc.user_group.activate();
37 tc.show_unused_options();
38 tc.event_loop_bar.signal();
39 break;
41 throw Exception("event loop barrier timeout");
43 throw Exception("event loop barrier error");
44 }
45}
46} // namespace openvpn
47
48#endif
Support deferred server-side state creation when client connects.
Definition ovpncli.cpp:95
void event_loop_wait_barrier(THREAD_COMMON &tc, const unsigned int seconds=WAIT_BARRIER_TIMEOUT)
static constexpr unsigned int WAIT_BARRIER_TIMEOUT