summaryrefslogtreecommitdiff
path: root/radsecproxy.c
diff options
context:
space:
mode:
authorvenaas <venaas>2007-01-08 16:47:37 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2007-01-08 16:47:37 +0000
commit036bbbf5d85699187824ecf808414f40f0d5594f (patch)
tree2b36eae9a1f1c7835352ddd0e3d1134a8870ac51 /radsecproxy.c
parentec6870142cd361a16ff11fd655b94a7fd4dbabcb (diff)
bug fixing
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@34 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'radsecproxy.c')
-rw-r--r--radsecproxy.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index 5abdd16..4f16987 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -494,17 +494,24 @@ void sendrq(struct server *to, struct client *from, struct request *rq) {
int i;
pthread_mutex_lock(&to->newrq_mutex);
-
- /* should search from where inserted last */
- for (i = 0; i < MAX_REQUESTS; i++)
+ /* might simplify if only try nextid, might be ok */
+ for (i = to->nextid; i < MAX_REQUESTS; i++)
if (!to->requests[i].buf)
break;
if (i == MAX_REQUESTS) {
- printf("No room in queue, dropping request\n");
- pthread_mutex_unlock(&to->newrq_mutex);
- return;
+ for (i = 0; i < to->nextid; i++)
+ if (!to->requests[i].buf)
+ break;
+ if (i == to->nextid) {
+ printf("No room in queue, dropping request\n");
+ pthread_mutex_unlock(&to->newrq_mutex);
+ return;
+ }
}
+
+ to->nextid = i + 1;
rq->buf[1] = (char)i;
+ printf("sendrq: inserting packet with id %d in queue for %s\n", i, to->peer.host);
if (!createmessageauth(rq->buf, rq->messageauthattrval, to->peer.secret))
return;