]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
fix ICP neighbor round-robin
authorwessels <>
Sat, 21 Dec 1996 06:20:56 +0000 (06:20 +0000)
committerwessels <>
Sat, 21 Dec 1996 06:20:56 +0000 (06:20 +0000)
src/neighbors.cc

index 2bc9d406fda8a07dcabfb1c1cd900f42f72d18c2..3693b973e38a36e3ad8825210159e4bf79e2d539 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: neighbors.cc,v 1.101 1996/12/19 23:13:31 wessels Exp $
+ * $Id: neighbors.cc,v 1.102 1996/12/20 23:20:56 wessels Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -321,6 +321,7 @@ neighborRemove(edge * target)
        safe_free(e);
        friends.n--;
     }
+    friends.first_ping = friends.edges_head;
 }
 
 void
@@ -441,10 +442,10 @@ neighborsUdpPing(protodispatch_data * proto)
        debug(15, 0, "Check 'icp_port' in your config file\n");
        fatal_dump(NULL);
     }
+    if (entry->swap_status != NO_SWAP)
+        fatal_dump("neighborsUdpPing: bad swap_status");
     for (i = 0, e = friends.first_ping; i++ < friends.n; e = e->next) {
-       if (entry->swap_status != NO_SWAP)
-           fatal_dump("neighborsUdpPing: bad swap_status");
-       if (e == (edge *) NULL)
+       if (e == NULL)
            e = friends.edges_head;
        debug(15, 5, "neighborsUdpPing: Edge %s\n", e->host);
 
@@ -515,8 +516,9 @@ neighborsUdpPing(protodispatch_data * proto)
                    e->host, e->http_port, e->icp_port);
            }
        }
-       friends.first_ping = e->next;
     }
+    if ((friends.first_ping = friends.first_ping->next) == NULL)
+       friends.first_ping = friends.edges_head;
 
     /* only do source_ping if we have neighbors */
     if (friends.n) {
@@ -774,6 +776,8 @@ neighborAdd(const char *host,
        friends.edges_tail->next = e;
     friends.edges_tail = e;
     friends.n++;
+    if (!friends.first_ping)
+       friends.first_ping = e;
 }
 
 void