]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed select-spin bug when an ICP reply actually gets queued
authorwessels <>
Wed, 15 Jul 1998 04:55:59 +0000 (04:55 +0000)
committerwessels <>
Wed, 15 Jul 1998 04:55:59 +0000 (04:55 +0000)
and we failed to execute the write callback

ChangeLog
src/comm.cc
src/globals.h
src/icp_v2.cc
src/protos.h

index dcfe6de29b5f45f331a01c1b01295611eb7f4a33..b4a5cf2383d8b7e2b1394e58a5e5e776dc6eb891 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,6 +31,8 @@
        - Moved 'miss_access' ACL check from client_side.c to forward.c
        - Fixed logging of usernames for requests which require
          proxy-authentication.
+       - Fixed select-spin bug when an ICP reply actually gets queued
+         and we failed to execute the write callback.
 
 Changes to squid-1.2.beta22 (June 1, 1998):
 
index 53dcb4393b75a33603f78c46ec84e26a1ee7dd7b..8a58dface061d87d6465c547d391ff9f9551fde1 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: comm.cc,v 1.272 1998/06/26 04:23:33 wessels Exp $
+ * $Id: comm.cc,v 1.273 1998/07/14 22:55:59 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -777,6 +777,8 @@ comm_incoming(void)
        icpHandleUdp(theInIcpConnection, &incame);
        if (theInIcpConnection != theOutIcpConnection)
            icpHandleUdp(theOutIcpConnection, &incame);
+       if (IcpQueueHead)
+           icpUdpSendQueue(theOutIcpConnection, NULL);
     }
     for (j = 0; j < NHttpSockets; j++) {
        if (HttpSockets[j] < 0)
index 348b6f0560c2d8e44d02bb484ad22b098d401c21..896571633e83b01d5c32b82e6dfd3633e090f98f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: globals.h,v 1.59 1998/06/02 21:38:08 rousskov Exp $
+ * $Id: globals.h,v 1.60 1998/07/14 22:56:00 wessels Exp $
  */
 
 extern FILE *debug_log;                /* NULL */
@@ -106,3 +106,4 @@ extern const char *StoreDigestUrlPath;      /* "store_digest" */
 extern const char *StoreDigestMimeStr; /* "application/cache-digest" */
 extern const Version CacheDigestVer;   /* { 3, 3 } */
 extern const char *MultipartMsgBoundaryStr; /* "Unique-Squid-Separator" */
+extern icpUdpData *IcpQueueHead; /* NULL */
index 32e1ccdef663891d087e34ca99eef1f49d21a38b..f94520bc02bb0ce6469e5e1ac715efd2ec4957b6 100644 (file)
@@ -3,11 +3,13 @@
 
 static void icpLogIcp(struct in_addr, log_type, int, const char *, int);
 static void icpHandleIcpV2(int, struct sockaddr_in, char *, int);
-static PF icpUdpSendQueue;
 static void icpCount(void *, int, size_t, int);
 
-static icpUdpData *UdpQueueHead = NULL;
-static icpUdpData *UdpQueueTail = NULL;
+/*
+ * IcpQueueHead is global so comm_incoming() knows whether or not
+ * to call icpUdpSendQueue.
+ */
+static icpUdpData *IcpQueueTail = NULL;
 
 static void
 icpLogIcp(struct in_addr caddr, log_type logcode, int len, const char *url, int delay)
@@ -30,17 +32,17 @@ icpLogIcp(struct in_addr caddr, log_type logcode, int len, const char *url, int
     accessLogLog(&al);
 }
 
-static void
+void
 icpUdpSendQueue(int fd, void *unused)
 {
     icpUdpData *q;
     int x;
     int delay;
-    while ((q = UdpQueueHead) != NULL) {
+    while ((q = IcpQueueHead) != NULL) {
        delay = tvSubUsec(q->queue_time, current_time);
        /* increment delay to prevent looping */
        x = icpUdpSend(fd, &q->address, q->msg, q->logcode, ++delay);
-       UdpQueueHead = q->next;
+       IcpQueueHead = q->next;
        safe_free(q);
        if (x < 0)
            break;
@@ -109,15 +111,15 @@ icpUdpSend(int fd,
        queue->len = (int) ntohs(msg->length);
        queue->queue_time = current_time;
        queue->logcode = logcode;
-       if (UdpQueueHead == NULL) {
-           UdpQueueHead = queue;
-           UdpQueueTail = queue;
-       } else if (UdpQueueTail == UdpQueueHead) {
-           UdpQueueTail = queue;
-           UdpQueueHead->next = queue;
+       if (IcpQueueHead == NULL) {
+           IcpQueueHead = queue;
+           IcpQueueTail = queue;
+       } else if (IcpQueueTail == IcpQueueHead) {
+           IcpQueueTail = queue;
+           IcpQueueHead->next = queue;
        } else {
-           UdpQueueTail->next = queue;
-           UdpQueueTail = queue;
+           IcpQueueTail->next = queue;
+           IcpQueueTail = queue;
        }
        commSetSelect(fd, COMM_SELECT_WRITE, icpUdpSendQueue, NULL, 0);
        Counter.icp.replies_queued++;
index 33f950c0ffeccce18c5b69ac57e7a5c6e4fe5efb..6810816c3035f5fc84e7e449c7fb6a49960a87aa 100644 (file)
@@ -440,6 +440,7 @@ extern void *icpCreateMessage(icp_opcode opcode,
     int pad);
 extern int icpUdpSend(int, const struct sockaddr_in *, icp_common_t *, log_type, int);
 extern PF icpHandleUdp;
+extern PF icpUdpSendQueue;
 extern PF httpAccept;
 
 #ifdef SQUID_SNMP