]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Fix trust socket list.
authorGunnar Beutner <redacted>
Wed, 26 Jun 2013 22:05:20 +0000 (00:05 +0200)
committerGunnar Beutner <redacted>
Wed, 26 Jun 2013 22:05:20 +0000 (00:05 +0200)
--HG--
branch : shroudtrusts

trusts/trusts_policy.c

index 4cfa8e52e6f607b5e7b3705472050220fd4aa69d..87154e4ac44f8ca89c114e06ef3ad8eabee141a6 100644 (file)
@@ -210,7 +210,7 @@ static int trustkillconnection(trustsocket *sock, char *reason) {
 }
 
 static void trustfreeconnection(trustsocket *sock, int unlink) {
-  trustsocket **pnext = &tslist;
+  trustsocket **pnext, *ts;
 
   if(!unlink) {
     deregisterhandler(sock->fd, 1);
@@ -218,7 +218,9 @@ static void trustfreeconnection(trustsocket *sock, int unlink) {
     return;
   }
 
-  for(trustsocket *ts=*pnext;ts;pnext=&((*pnext)->next)) {
+  pnext = &tslist;
+  
+  for(ts=*pnext;*pnext;pnext=&((*pnext)->next)) {
     if(ts == sock) {
       *pnext = sock->next;
       trustfreeconnection(sock, 0);
@@ -361,13 +363,11 @@ static void trustdotimeout(void *arg) {
 
   pnext = &tslist;
     
-  for(sock=*pnext;sock;) {
+  for(sock=*pnext;*pnext;pnext=&((*pnext)->next)) {
     if(!sock->authed && t >= sock->timeout) {
       trustkillconnection(sock, "Auth timeout.");
       *pnext = sock->next;
       trustfreeconnection(sock, 0);
-    } else {
-      pnext = &((*pnext)->next);
     }
   }
 }