]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix spurious assert on exit
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 18 Apr 2023 11:16:45 +0000 (21:16 +1000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 18 Apr 2023 11:16:45 +0000 (21:16 +1000)
src/lib/io/network.c

index 9884c4b18785943e723938aef2ee5ab3f8b6e3c1..7eac95e99415949827849f0a1ad3864485c7f540 100644 (file)
@@ -83,7 +83,7 @@ typedef struct {
        bool                    dead;                   //!< is it dead?
        bool                    blocked;                //!< is it blocked?
 
-       size_t                  outstanding;            //!< number of outstanding packets sent to the worker
+       unsigned int            outstanding;            //!< number of outstanding packets sent to the worker
        fr_listen_t             *listen;                //!< I/O ctx and functions.
 
        fr_message_set_t        *ms;                    //!< message buffers for this socket.
@@ -1657,7 +1657,15 @@ int fr_network_destroy(fr_network_t *nr)
                if (fr_rb_flatten_inorder(nr, (void ***)&sockets, nr->sockets) < 0) return -1;
                len = talloc_array_length(sockets);
 
-               for (i = 0; i < len; i++) talloc_free(sockets[i]);
+               for (i = 0; i < len; i++) {
+                       /*
+                        *      Force to zero so we don't trigger asserts
+                        *      if packets are being processed and the
+                        *      server exits.
+                        */
+                       sockets[i]->outstanding = 0;
+                       talloc_free(sockets[i]);
+               }
 
                talloc_free(sockets);
        }