From: Arne Schwabe Date: Tue, 26 Apr 2022 13:23:23 +0000 (+0200) Subject: Change FULL_SYNC macro to no_pending_reliable_packets function X-Git-Tag: v2.6_beta1~221 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04c3779922aed541755a20f415e7cb9d717ee7ed;p=thirdparty%2Fopenvpn.git Change FULL_SYNC macro to no_pending_reliable_packets function This changes this macro to a better named inline function. This introduces a slight whitespace problem but the next refactoring will move the incorrectly intended block to its own function anyway. Acked-by: Gert Doering Message-Id: <20220426132324.76517-1-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24213.html Signed-off-by: Gert Doering --- diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index bad59f2a1..6c6648afa 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -1774,8 +1774,11 @@ flush_payload_buffer(struct key_state *ks) } /* true if no in/out acknowledgements pending */ -#define FULL_SYNC \ - (reliable_empty(ks->send_reliable) && reliable_ack_empty(ks->rec_ack)) +static bool +no_pending_reliable_packets(struct key_state *ks) +{ + return (reliable_empty(ks->send_reliable) && reliable_ack_empty(ks->rec_ack)); +} /* * Move the active key to the lame duck key and reinitialize the @@ -2518,7 +2521,7 @@ tls_process(struct tls_multi *multi, } /* Wait for Initial Handshake ACK */ - if (ks->state == S_PRE_START && FULL_SYNC) + if (ks->state == S_PRE_START && no_pending_reliable_packets(ks)) { ks->state = S_START; state_change = true; @@ -2544,7 +2547,7 @@ tls_process(struct tls_multi *multi, if (((ks->state == S_GOT_KEY && !session->opt->server) || (ks->state == S_SENT_KEY && session->opt->server))) { - if (FULL_SYNC) + if (no_pending_reliable_packets(ks)) { ks->established = now; dmsg(D_TLS_DEBUG_MED, "STATE S_ACTIVE");