]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
call error handler on connect error
authorAlan T. DeKok <aland@freeradius.org>
Sun, 8 Dec 2024 14:24:10 +0000 (09:24 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 8 Dec 2024 14:27:20 +0000 (09:27 -0500)
src/lib/bio/fd.c

index d17d3eb20a5fd4560c4faf2d5e4dcda07cdf3815..38ebc62f7d84b99d15f0cb7e76c6487d4d3f49b7 100644 (file)
@@ -1243,6 +1243,12 @@ int fr_bio_fd_connect_full(fr_bio_t *bio, fr_event_list_t *el, fr_bio_callback_t
         */
        if (my->info.type == FR_BIO_FD_UNCONNECTED) {
        error:
+#ifdef ECONNABORTED
+               my->info.connect_errno = ECONNABORTED;
+#else
+               my->info.connect_errno = ECONNREFUSED;
+#endif
+               if (error_cb) error_cb(bio);
                fr_bio_shutdown(&my->bio);
                return fr_bio_error(GENERIC);
        }
@@ -1279,7 +1285,10 @@ int fr_bio_fd_connect_full(fr_bio_t *bio, fr_event_list_t *el, fr_bio_callback_t
                ssize_t rcode;
 
                rcode = fr_bio_fd_try_connect(my);
-               if (rcode < 0) return rcode; /* it already called shutdown */
+               if (rcode < 0) {
+                       if (error_cb) error_cb(bio);
+                       return rcode; /* it already called shutdown */
+               }
 
                return 1;
        }