/*
- * $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
icpHandleUdp(theInIcpConnection, &incame);
if (theInIcpConnection != theOutIcpConnection)
icpHandleUdp(theOutIcpConnection, &incame);
+ if (IcpQueueHead)
+ icpUdpSendQueue(theOutIcpConnection, NULL);
}
for (j = 0; j < NHttpSockets; j++) {
if (HttpSockets[j] < 0)
/*
- * $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 */
extern const char *StoreDigestMimeStr; /* "application/cache-digest" */
extern const Version CacheDigestVer; /* { 3, 3 } */
extern const char *MultipartMsgBoundaryStr; /* "Unique-Squid-Separator" */
+extern icpUdpData *IcpQueueHead; /* NULL */
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)
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;
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++;