]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move retransmission to it's own function
authorAlan T. DeKok <aland@freeradius.org>
Fri, 25 Aug 2017 13:59:30 +0000 (09:59 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 25 Aug 2017 13:59:30 +0000 (09:59 -0400)
src/modules/rlm_radius/rlm_radius_udp.c

index 536befe28342a81886b91e2f9b8b0b963d749447..b4e6275db8ca8d569fb93b7d6ec6c9c639aba6fe 100644 (file)
@@ -852,34 +852,11 @@ static void status_check_timeout(UNUSED fr_event_list_t *el, struct timeval *now
        if (!c->pending) fd_active(c);
 }
 
-
-/** Deal with per-request timeouts for transmissions, etc.
- *
- */
-static void response_timeout(UNUSED fr_event_list_t *el, struct timeval *now, void *uctx)
+static void retransmit_packet(rlm_radius_udp_request_t *u, struct timeval *now)
 {
        int rcode;
-       rlm_radius_udp_request_t *u = uctx;
        rlm_radius_udp_connection_t *c = u->c;
-       REQUEST *request;
-
-       rcode = rr_track_retry(c->id, u->rr, c->thread->el, response_timeout, u, &c->inst->parent->retry[u->code], now);
-       if (rcode < 0) {
-               /*
-                *      Failed inserting event... the request is done.
-                */
-               mod_finished_request(c, u);
-               return;
-       }
-
-       request = u->link->request;
-       if (rcode == 0) {
-               conn_zombie(c);
-               REDEBUG("Failing proxied request ID %d due to lack of response on connection %s",
-                       u->rr->id, c->name);
-               mod_finished_request(c, u);
-               return;
-       }
+       REQUEST *request = u->link->request;
 
        /*
         *      RADIUS layer fixups for Accounting-Request packets.
@@ -985,6 +962,38 @@ static void response_timeout(UNUSED fr_event_list_t *el, struct timeval *now, vo
 }
 
 
+/** Deal with per-request timeouts for transmissions, etc.
+ *
+ */
+static void response_timeout(UNUSED fr_event_list_t *el, struct timeval *now, void *uctx)
+{
+       int rcode;
+       rlm_radius_udp_request_t *u = uctx;
+       rlm_radius_udp_connection_t *c = u->c;
+       REQUEST *request;
+
+       rcode = rr_track_retry(c->id, u->rr, c->thread->el, response_timeout, u, &c->inst->parent->retry[u->code], now);
+       if (rcode < 0) {
+               /*
+                *      Failed inserting event... the request is done.
+                */
+               mod_finished_request(c, u);
+               return;
+       }
+
+       request = u->link->request;
+       if (rcode == 0) {
+               conn_zombie(c);
+               REDEBUG("Failing proxied request ID %d due to lack of response on connection %s",
+                       u->rr->id, c->name);
+               mod_finished_request(c, u);
+               return;
+       }
+
+       retransmit_packet(u, now);
+}
+
+
 /** Write a packet to a connection
  *
  * @param c the conneciton