]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
close sockets when we close the app_io
authorAlan T. DeKok <aland@freeradius.org>
Fri, 23 Jun 2017 19:30:09 +0000 (15:30 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 23 Jun 2017 19:30:09 +0000 (15:30 -0400)
src/modules/proto_radius/proto_radius_udp.c

index 0185154f075e7287660e0e31ad41d2c891b7edef..169a27569ac7698f0d2169b4ed325e92758b41fd 100644 (file)
@@ -479,6 +479,21 @@ static int mod_bootstrap(void *instance, UNUSED CONF_SECTION *cs)
        return 0;
 }
 
+static int mod_detach(void *instance)
+{
+       proto_radius_udp_t      *inst = talloc_get_type_abort(instance, proto_radius_udp_t);
+
+       /*
+        *      @todo - have our OWN event loop for timers, and a
+        *      "copy timer from -> to, which means we only have to
+        *      delete our child event loop from the parent on close.
+        */
+
+       close(inst->sockfd);
+       return 0;
+}
+
+
 /** Private interface for use by proto_radius
  *
  */
@@ -495,6 +510,7 @@ fr_app_io_t proto_radius_udp = {
        .name                   = "radius_udp",
        .config                 = udp_listen_config,
        .inst_size              = sizeof(proto_radius_udp_t),
+       .detach                 = mod_detach,
        .bootstrap              = mod_bootstrap,
        .instantiate            = mod_instantiate,