Added "one shot" configuration
authorAlan T. DeKok <aland@freeradius.org>
Wed, 29 Dec 2010 07:34:37 +0000 (08:34 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 30 Dec 2010 10:06:42 +0000 (11:06 +0100)
src/include/detail.h
src/main/detail.c

index e3c13ee..82c33ac 100644 (file)
@@ -43,6 +43,7 @@ typedef struct listen_detail_t {
        int             retry_interval;
        int             packets;
        int             tries;
+       int             one_shot;
 
        int             has_rtt;
        int             srtt;
index 6b6e49b..5b23d78 100644 (file)
@@ -399,6 +399,12 @@ int detail_recv(rad_listen_t *listener,
                                listener->fd = -1;
                                data->state = STATE_UNOPENED;
                                rad_assert(data->vps == NULL);
+
+                               if (data->one_shot) {
+                                       radlog(L_INFO, "Finished reading \"one shot\" detail file - Exiting");
+                                       radius_signal_self(RADIUS_SIGNAL_SELF_EXIT);
+                               }
+
                                return 0;
                        }
 
@@ -832,6 +838,8 @@ static const CONF_PARSER detail_config[] = {
          offsetof(listen_detail_t, poll_interval), NULL, Stringify(1)},
        { "retry_interval",   PW_TYPE_INTEGER,
          offsetof(listen_detail_t, retry_interval), NULL, Stringify(30)},
+       { "one_shot",   PW_TYPE_BOOLEAN,
+         offsetof(listen_detail_t, one_shot), NULL, NULL},
 
        { NULL, -1, 0, NULL, NULL }             /* end the list */
 };