Moved rl_add_proxy from radiusd.c to proxy.c, so we can
authoraland <aland>
Fri, 14 May 2004 08:47:12 +0000 (08:47 +0000)
committeraland <aland>
Fri, 14 May 2004 08:47:12 +0000 (08:47 +0000)
allocate Id's, and insert the request into the proxy queue, before
it's sent to the home server

src/main/proxy.c
src/main/radiusd.c

index 25fccb2..5d21a47 100644 (file)
@@ -41,6 +41,7 @@ static const char rcsid[] = "$Id$";
 #include "radiusd.h"
 #include "rad_assert.h"
 #include "modules.h"
+#include "request_list.h"
 
 static uint32_t proxy_id = 1;
 
@@ -473,6 +474,16 @@ int proxy_send(REQUEST *request)
                 *      care of doing that.
                 */
                if ((request->options & RAD_REQUEST_OPTION_FAKE_REQUEST) == 0) {
+                       /*
+                        *      Add the proxied request to the
+                        *      list of outstanding proxied
+                        *      requests, BEFORE we send it, so
+                        *      we have fewer problems with race
+                        *      conditions when the responses come
+                        *      back very quickly.
+                        */
+                       rl_add_proxy(request);
+
                        rad_send(request->proxy, NULL,
                                 (char *)request->proxysecret);
                }
index 95f528d..c895834 100644 (file)
@@ -1752,13 +1752,6 @@ int rad_respond(REQUEST *request, RAD_REQUEST_FUNP fun)
                         *  the reply packet from the home server.
                         */
                        case RLM_MODULE_HANDLED:
-                               /*
-                                *      Add the proxied request to the
-                                *      list of outstanding proxied
-                                *      requests.
-                                */
-                               rl_add_proxy(request);
-
                                goto postpone_request;
                                break;
                        }