From: Alan T. DeKok Date: Sun, 31 Mar 2024 00:14:17 +0000 (-0400) Subject: update comments and check for async with connect X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8698e5a630687d88b9854bfe97552cd98b41643f;p=thirdparty%2Ffreeradius-server.git update comments and check for async with connect --- diff --git a/src/lib/bio/fd.c b/src/lib/bio/fd.c index 0d6833a745c..8cc0bccb3a8 100644 --- a/src/lib/bio/fd.c +++ b/src/lib/bio/fd.c @@ -819,6 +819,11 @@ int fr_bio_fd_init_connected(fr_bio_fd_t *my) } #endif + /* + * Don't call connect() if the socket is synchronous, it will block. + */ + if (!my->info.cfg->async) return 0; + return fr_bio_fd_try_connect(my); } diff --git a/src/lib/bio/fd_open.c b/src/lib/bio/fd_open.c index 30cd9bfb438..1f93fa2f986 100644 --- a/src/lib/bio/fd_open.c +++ b/src/lib/bio/fd_open.c @@ -685,7 +685,7 @@ static int fr_bio_fd_socket_bind(fr_bio_fd_t *my, fr_bio_fd_config_t const *cfg) /** Opens a socket and updates sock->fd * - * Note that it does not call connect()! + * If the socket is asynchronous, it also calls connect() */ int fr_bio_fd_open(fr_bio_t *bio, fr_bio_fd_config_t const *cfg) { @@ -878,7 +878,6 @@ int fr_bio_fd_open(fr_bio_t *bio, fr_bio_fd_config_t const *cfg) if (rcode < 0) goto fail; } - switch (my->info.socket.af) { case AF_LOCAL: if (fr_bio_fd_socket_bind_unix(my, cfg) < 0) goto fail;