From: Alan T. DeKok Date: Tue, 2 Apr 2024 16:37:06 +0000 (-0400) Subject: WOULD_BLOCK is not a fatal error when opening connected sockets X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e042f4c3a5d012f747fd3d62963d38243a637981;p=thirdparty%2Ffreeradius-server.git WOULD_BLOCK is not a fatal error when opening connected sockets --- diff --git a/src/lib/bio/fd.c b/src/lib/bio/fd.c index 8cc0bccb3a8..26c9ae910d9 100644 --- a/src/lib/bio/fd.c +++ b/src/lib/bio/fd.c @@ -776,6 +776,8 @@ static int fr_bio_fd_init_file(fr_bio_fd_t *my) int fr_bio_fd_init_connected(fr_bio_fd_t *my) { + int rcode; + if (my->info.socket.af == AF_FILE_BIO) return fr_bio_fd_init_file(my); /* @@ -824,7 +826,15 @@ int fr_bio_fd_init_connected(fr_bio_fd_t *my) */ if (!my->info.cfg->async) return 0; - return fr_bio_fd_try_connect(my); + rcode = fr_bio_fd_try_connect(my); + if (rcode == 0) return 0; + + if (rcode != fr_bio_error(IO_WOULD_BLOCK)) return rcode; + + fr_assert(my->info.write_blocked); + fr_assert(my->info.state == FR_BIO_FD_STATE_CONNECTING); + + return 0; } int fr_bio_fd_init_common(fr_bio_fd_t *my)