Rename the function to better capture its actual function.
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20200810143707.5834-9-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20675.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
| ... | ... |
@@ -46,12 +46,8 @@ const uint8_t ping_string[] = {
|
| 46 | 46 |
0x07, 0xed, 0x2d, 0x0a, 0x98, 0x1f, 0xc7, 0x48 |
| 47 | 47 |
}; |
| 48 | 48 |
|
| 49 |
-/* |
|
| 50 |
- * Should we exit or restart due to ping (or other authenticated packet) |
|
| 51 |
- * not received in n seconds? |
|
| 52 |
- */ |
|
| 53 | 49 |
void |
| 54 |
-check_ping_restart_dowork(struct context *c) |
|
| 50 |
+trigger_ping_timeout_signal(struct context *c) |
|
| 55 | 51 |
{
|
| 56 | 52 |
struct gc_arena gc = gc_new(); |
| 57 | 53 |
switch (c->options.ping_rec_timeout_action) |
| ... | ... |
@@ -43,7 +43,12 @@ is_ping_msg(const struct buffer *buf) |
| 43 | 43 |
return buf_string_match(buf, ping_string, PING_STRING_SIZE); |
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 |
-void check_ping_restart_dowork(struct context *c); |
|
| 46 |
+/** |
|
| 47 |
+ * Trigger the correct signal on a --ping timeout |
|
| 48 |
+ * depending if --ping-exit is set (SIGTERM) or not |
|
| 49 |
+ * (SIGUSR1) |
|
| 50 |
+ */ |
|
| 51 |
+void trigger_ping_timeout_signal(struct context *c); |
|
| 47 | 52 |
|
| 48 | 53 |
void check_ping_send_dowork(struct context *c); |
| 49 | 54 |
|
| ... | ... |
@@ -54,8 +59,6 @@ void check_ping_send_dowork(struct context *c); |
| 54 | 54 |
static inline void |
| 55 | 55 |
check_ping_restart(struct context *c) |
| 56 | 56 |
{
|
| 57 |
- void check_ping_restart_dowork(struct context *c); |
|
| 58 |
- |
|
| 59 | 57 |
if (c->options.ping_rec_timeout |
| 60 | 58 |
&& event_timeout_trigger(&c->c2.ping_rec_interval, |
| 61 | 59 |
&c->c2.timeval, |
| ... | ... |
@@ -63,7 +66,7 @@ check_ping_restart(struct context *c) |
| 63 | 63 |
|| link_socket_actual_defined(&c->c1.link_socket_addr.actual)) |
| 64 | 64 |
? ETT_DEFAULT : 15)) |
| 65 | 65 |
{
|
| 66 |
- check_ping_restart_dowork(c); |
|
| 66 |
+ trigger_ping_timeout_signal(c); |
|
| 67 | 67 |
} |
| 68 | 68 |
} |
| 69 | 69 |
|
| ... | ... |
@@ -73,8 +76,6 @@ check_ping_restart(struct context *c) |
| 73 | 73 |
static inline void |
| 74 | 74 |
check_ping_send(struct context *c) |
| 75 | 75 |
{
|
| 76 |
- void check_ping_send_dowork(struct context *c); |
|
| 77 |
- |
|
| 78 | 76 |
if (c->options.ping_send_timeout |
| 79 | 77 |
&& event_timeout_trigger(&c->c2.ping_send_interval, |
| 80 | 78 |
&c->c2.timeval, |