]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
update comments and check for async with connect
authorAlan T. DeKok <aland@freeradius.org>
Sun, 31 Mar 2024 00:14:17 +0000 (20:14 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 31 Mar 2024 00:14:17 +0000 (20:14 -0400)
src/lib/bio/fd.c
src/lib/bio/fd_open.c

index 0d6833a745cc12dfbf57f6cff05c0c97efe565a7..8cc0bccb3a89ec63894e65f64dcbf6eeb5d2597a 100644 (file)
@@ -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);
 }
 
index 30cd9bfb43865cae1cbfbd52312a925c3e76349f..1f93fa2f9865bad7453d68e5b985580abd46ab4c 100644 (file)
@@ -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;