ModSelect.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 /* DEBUG: section 05 Socket Functions */
10 
11 #include "squid.h"
12 
13 #if USE_SELECT
14 
15 #include "anyp/PortCfg.h"
16 #include "comm/Connection.h"
17 #include "comm/Loops.h"
18 #include "fde.h"
19 #include "globals.h"
20 #include "ICP.h"
21 #include "mgr/Registration.h"
22 #include "SquidConfig.h"
23 #include "SquidTime.h"
24 #include "StatCounters.h"
25 #include "StatHist.h"
26 #include "Store.h"
27 
28 #include <cerrno>
29 #if HAVE_SYS_STAT_H
30 #include <sys/stat.h>
31 #endif
32 
33 static int MAX_POLL_TIME = 1000; /* see also Comm::QuickPollRequired() */
34 
35 #ifndef howmany
36 #define howmany(x, y) (((x)+((y)-1))/(y))
37 #endif
38 #ifndef NBBY
39 #define NBBY 8
40 #endif
41 #define FD_MASK_BYTES sizeof(fd_mask)
42 #define FD_MASK_BITS (FD_MASK_BYTES*NBBY)
43 
44 /* STATIC */
45 static int examine_select(fd_set *, fd_set *);
46 static int fdIsTcpListener(int fd);
47 static int fdIsUdpListener(int fd);
48 static int fdIsDns(int fd);
50 static int comm_check_incoming_select_handlers(int nfds, int *fds);
51 static void comm_select_dns_incoming(void);
52 static void commUpdateReadBits(int fd, PF * handler);
53 static void commUpdateWriteBits(int fd, PF * handler);
54 
55 static struct timeval zero_tv;
56 static fd_set global_readfds;
57 static fd_set global_writefds;
58 static int nreadfds;
59 static int nwritefds;
60 
61 /*
62  * Automatic tuning for incoming requests:
63  *
64  * INCOMING sockets are the ICP and HTTP ports. We need to check these
65  * fairly regularly, but how often? When the load increases, we
66  * want to check the incoming sockets more often. If we have a lot
67  * of incoming ICP, then we need to check these sockets more than
68  * if we just have HTTP.
69  *
70  * The variables 'incoming_udp_interval' and 'incoming_tcp_interval'
71  * determine how many normal I/O events to process before checking
72  * incoming sockets again. Note we store the incoming_interval
73  * multipled by a factor of (2^INCOMING_FACTOR) to have some
74  * pseudo-floating point precision.
75  *
76  * The variable 'udp_io_events' and 'tcp_io_events' counts how many normal
77  * I/O events have been processed since the last check on the incoming
78  * sockets. When io_events > incoming_interval, its time to check incoming
79  * sockets.
80  *
81  * Every time we check incoming sockets, we count how many new messages
82  * or connections were processed. This is used to adjust the
83  * incoming_interval for the next iteration. The new incoming_interval
84  * is calculated as the current incoming_interval plus what we would
85  * like to see as an average number of events minus the number of
86  * events just processed.
87  *
88  * incoming_interval = incoming_interval + target_average - number_of_events_processed
89  *
90  * There are separate incoming_interval counters for DNS, UDP and TCP events
91  *
92  * You can see the current values of the incoming_interval's, as well as
93  * a histogram of 'incoming_events' by asking the cache manager
94  * for 'comm_incoming', e.g.:
95  *
96  * % ./client mgr:comm_incoming
97  *
98  * Caveats:
99  *
100  * - We have MAX_INCOMING_INTEGER as a magic upper limit on
101  * incoming_interval for both types of sockets. At the
102  * largest value the cache will effectively be idling.
103  *
104  * - The higher the INCOMING_FACTOR, the slower the algorithm will
105  * respond to load spikes/increases/decreases in demand. A value
106  * between 3 and 8 is recommended.
107  */
108 
109 #define MAX_INCOMING_INTEGER 256
110 #define INCOMING_FACTOR 5
111 #define MAX_INCOMING_INTERVAL (MAX_INCOMING_INTEGER << INCOMING_FACTOR)
112 static int udp_io_events = 0;
113 static int dns_io_events = 0;
114 static int tcp_io_events = 0;
118 #define commCheckUdpIncoming (++udp_io_events > (incoming_udp_interval>> INCOMING_FACTOR))
119 #define commCheckDnsIncoming (++dns_io_events > (incoming_dns_interval>> INCOMING_FACTOR))
120 #define commCheckTcpIncoming (++tcp_io_events > (incoming_tcp_interval>> INCOMING_FACTOR))
121 
122 void
123 Comm::SetSelect(int fd, unsigned int type, PF * handler, void *client_data, time_t timeout)
124 {
125  fde *F = &fd_table[fd];
126  assert(fd >= 0);
127  assert(F->flags.open || (!handler && !client_data && !timeout));
128  debugs(5, 5, HERE << "FD " << fd << ", type=" << type <<
129  ", handler=" << handler << ", client_data=" << client_data <<
130  ", timeout=" << timeout);
131 
132  if (type & COMM_SELECT_READ) {
133  F->read_handler = handler;
134  F->read_data = client_data;
135  commUpdateReadBits(fd, handler);
136  }
137 
138  if (type & COMM_SELECT_WRITE) {
139  F->write_handler = handler;
140  F->write_data = client_data;
141  commUpdateWriteBits(fd, handler);
142  }
143 
144  if (timeout)
145  F->timeout = squid_curtime + timeout;
146 }
147 
148 static int
150 {
151  if (icpIncomingConn != NULL && fd == icpIncomingConn->fd)
152  return 1;
153 
154  if (icpOutgoingConn != NULL && fd == icpOutgoingConn->fd)
155  return 1;
156 
157  return 0;
158 }
159 
160 static int
161 fdIsDns(int fd)
162 {
163  if (fd == DnsSocketA)
164  return 1;
165 
166  if (fd == DnsSocketB)
167  return 1;
168 
169  return 0;
170 }
171 
172 static int
174 {
175  for (AnyP::PortCfgPointer s = HttpPortList; s != NULL; s = s->next) {
176  if (s->listenConn != NULL && s->listenConn->fd == fd)
177  return 1;
178  }
179 
180  return 0;
181 }
182 
183 static int
185 {
186  int i;
187  int fd;
188  int maxfd = 0;
189  PF *hdl = NULL;
190  fd_set read_mask;
191  fd_set write_mask;
192  FD_ZERO(&read_mask);
193  FD_ZERO(&write_mask);
195 
196  for (i = 0; i < nfds; ++i) {
197  fd = fds[i];
198 
199  if (fd_table[fd].read_handler) {
200  FD_SET(fd, &read_mask);
201 
202  if (fd > maxfd)
203  maxfd = fd;
204  }
205 
206  if (fd_table[fd].write_handler) {
207  FD_SET(fd, &write_mask);
208 
209  if (fd > maxfd)
210  maxfd = fd;
211  }
212  }
213 
214  if (maxfd++ == 0)
215  return -1;
216 
217  getCurrentTime();
218 
220 
221  if (select(maxfd, &read_mask, &write_mask, NULL, &zero_tv) < 1)
223 
224  for (i = 0; i < nfds; ++i) {
225  fd = fds[i];
226 
227  if (FD_ISSET(fd, &read_mask)) {
228  if ((hdl = fd_table[fd].read_handler) != NULL) {
229  fd_table[fd].read_handler = NULL;
231  hdl(fd, fd_table[fd].read_data);
232  } else {
233  debugs(5, DBG_IMPORTANT, "comm_select_incoming: FD " << fd << " NULL read handler");
234  }
235  }
236 
237  if (FD_ISSET(fd, &write_mask)) {
238  if ((hdl = fd_table[fd].write_handler) != NULL) {
239  fd_table[fd].write_handler = NULL;
241  hdl(fd, fd_table[fd].write_data);
242  } else {
243  debugs(5, DBG_IMPORTANT, "comm_select_incoming: FD " << fd << " NULL write handler");
244  }
245  }
246  }
247 
249 }
250 
251 static void
253 {
254  int nfds = 0;
255  int fds[2];
256  int nevents;
257  udp_io_events = 0;
258 
260  fds[nfds] = icpIncomingConn->fd;
261  ++nfds;
262  }
263 
265  fds[nfds] = icpOutgoingConn->fd;
266  ++nfds;
267  }
268 
269  if (nfds == 0)
270  return;
271 
272  nevents = comm_check_incoming_select_handlers(nfds, fds);
273 
274  incoming_udp_interval += Config.comm_incoming.udp.average - nevents;
275 
276  if (incoming_udp_interval < 0)
278 
281 
282  if (nevents > INCOMING_UDP_MAX)
283  nevents = INCOMING_UDP_MAX;
284 
286 }
287 
288 static void
290 {
291  int nfds = 0;
292  int fds[MAXTCPLISTENPORTS];
293  int nevents;
294  tcp_io_events = 0;
295 
296  // XXX: only poll sockets that won't be deferred. But how do we identify them?
297 
298  for (AnyP::PortCfgPointer s = HttpPortList; s != NULL; s = s->next) {
299  if (Comm::IsConnOpen(s->listenConn)) {
300  fds[nfds] = s->listenConn->fd;
301  ++nfds;
302  }
303  }
304 
305  nevents = comm_check_incoming_select_handlers(nfds, fds);
306  incoming_tcp_interval += Config.comm_incoming.tcp.average - nevents;
307 
308  if (incoming_tcp_interval < 0)
310 
313 
314  if (nevents > INCOMING_TCP_MAX)
315  nevents = INCOMING_TCP_MAX;
316 
318 }
319 
320 #define DEBUG_FDBITS 0
321 /* Select on all sockets; call handlers for those that are ready. */
323 Comm::DoSelect(int msec)
324 {
325  fd_set readfds;
326  fd_set pendingfds;
327  fd_set writefds;
328 
329  PF *hdl = NULL;
330  int fd;
331  int maxfd;
332  int num;
333  int pending;
334  int calldns = 0, calludp = 0, calltcp = 0;
335  int maxindex;
336  unsigned int k;
337  int j;
338 #if DEBUG_FDBITS
339 
340  int i;
341 #endif
342 
343  fd_mask *fdsp;
344  fd_mask *pfdsp;
345  fd_mask tmask;
346 
347  struct timeval poll_time;
348  double timeout = current_dtime + (msec / 1000.0);
349  fde *F;
350 
351  do {
352  double start;
353  getCurrentTime();
354  start = current_dtime;
355 
358 
361 
364 
365  calldns = calludp = calltcp = 0;
366 
367  maxfd = Biggest_FD + 1;
368 
369  memcpy(&readfds, &global_readfds,
371 
372  memcpy(&writefds, &global_writefds,
373  howmany(maxfd, FD_MASK_BITS) * FD_MASK_BYTES);
374 
375  /* remove stalled FDs, and deal with pending descriptors */
376  pending = 0;
377 
378  FD_ZERO(&pendingfds);
379 
380  maxindex = howmany(maxfd, FD_MASK_BITS);
381 
382  fdsp = (fd_mask *) & readfds;
383 
384  for (j = 0; j < maxindex; ++j) {
385  if ((tmask = fdsp[j]) == 0)
386  continue; /* no bits here */
387 
388  for (k = 0; k < FD_MASK_BITS; ++k) {
389  if (!EBIT_TEST(tmask, k))
390  continue;
391 
392  /* Found a set bit */
393  fd = (j * FD_MASK_BITS) + k;
394 
395  if (FD_ISSET(fd, &readfds) && fd_table[fd].flags.read_pending) {
396  FD_SET(fd, &pendingfds);
397  ++pending;
398  }
399  }
400  }
401 
402 #if DEBUG_FDBITS
403  for (i = 0; i < maxfd; ++i) {
404  /* Check each open socket for a handler. */
405 
406  if (fd_table[i].read_handler) {
407  assert(FD_ISSET(i, &readfds));
408  }
409 
410  if (fd_table[i].write_handler) {
411  assert(FD_ISSET(i, &writefds));
412  }
413  }
414 
415 #endif
416  if (nreadfds + nwritefds == 0) {
418  return Comm::SHUTDOWN;
419  }
420 
421  if (msec > MAX_POLL_TIME)
422  msec = MAX_POLL_TIME;
423 
424  if (pending)
425  msec = 0;
426 
427  for (;;) {
428  poll_time.tv_sec = msec / 1000;
429  poll_time.tv_usec = (msec % 1000) * 1000;
431  num = select(maxfd, &readfds, &writefds, NULL, &poll_time);
432  int xerrno = errno;
434 
435  if (num >= 0 || pending > 0)
436  break;
437 
438  if (ignoreErrno(xerrno))
439  break;
440 
441  debugs(5, DBG_CRITICAL, MYNAME << "select failure: " << xstrerr(xerrno));
442 
443  examine_select(&readfds, &writefds);
444 
445  return Comm::COMM_ERROR;
446 
447  /* NOTREACHED */
448  }
449 
450  if (num < 0 && !pending)
451  continue;
452 
453  getCurrentTime();
454 
455  debugs(5, num ? 5 : 8, "comm_select: " << num << "+" << pending << " FDs ready");
456 
458 
459  if (num == 0 && pending == 0)
460  continue;
461 
462  /* Scan return fd masks for ready descriptors */
463  fdsp = (fd_mask *) & readfds;
464 
465  pfdsp = (fd_mask *) & pendingfds;
466 
467  maxindex = howmany(maxfd, FD_MASK_BITS);
468 
469  for (j = 0; j < maxindex; ++j) {
470  if ((tmask = (fdsp[j] | pfdsp[j])) == 0)
471  continue; /* no bits here */
472 
473  for (k = 0; k < FD_MASK_BITS; ++k) {
474  if (tmask == 0)
475  break; /* no more bits left */
476 
477  if (!EBIT_TEST(tmask, k))
478  continue;
479 
480  /* Found a set bit */
481  fd = (j * FD_MASK_BITS) + k;
482 
483  EBIT_CLR(tmask, k); /* this will be done */
484 
485 #if DEBUG_FDBITS
486 
487  debugs(5, 9, "FD " << fd << " bit set for reading");
488 
489  assert(FD_ISSET(fd, &readfds));
490 
491 #endif
492 
493  if (fdIsUdpListener(fd)) {
494  calludp = 1;
495  continue;
496  }
497 
498  if (fdIsDns(fd)) {
499  calldns = 1;
500  continue;
501  }
502 
503  if (fdIsTcpListener(fd)) {
504  calltcp = 1;
505  continue;
506  }
507 
508  F = &fd_table[fd];
509  debugs(5, 6, "comm_select: FD " << fd << " ready for reading");
510 
511  if (NULL == (hdl = F->read_handler))
512  (void) 0;
513  else {
514  F->read_handler = NULL;
515  F->flags.read_pending = 0;
517  hdl(fd, F->read_data);
519 
522 
525 
528  }
529  }
530  }
531 
532  fdsp = (fd_mask *) & writefds;
533 
534  for (j = 0; j < maxindex; ++j) {
535  if ((tmask = fdsp[j]) == 0)
536  continue; /* no bits here */
537 
538  for (k = 0; k < FD_MASK_BITS; ++k) {
539  if (tmask == 0)
540  break; /* no more bits left */
541 
542  if (!EBIT_TEST(tmask, k))
543  continue;
544 
545  /* Found a set bit */
546  fd = (j * FD_MASK_BITS) + k;
547 
548  EBIT_CLR(tmask, k); /* this will be done */
549 
550 #if DEBUG_FDBITS
551 
552  debugs(5, 9, "FD " << fd << " bit set for writing");
553 
554  assert(FD_ISSET(fd, &writefds));
555 
556 #endif
557 
558  if (fdIsUdpListener(fd)) {
559  calludp = 1;
560  continue;
561  }
562 
563  if (fdIsDns(fd)) {
564  calldns = 1;
565  continue;
566  }
567 
568  if (fdIsTcpListener(fd)) {
569  calltcp = 1;
570  continue;
571  }
572 
573  F = &fd_table[fd];
574  debugs(5, 6, "comm_select: FD " << fd << " ready for writing");
575 
576  if ((hdl = F->write_handler)) {
577  F->write_handler = NULL;
579  hdl(fd, F->write_data);
581 
584 
587 
590  }
591  }
592  }
593 
594  if (calludp)
596 
597  if (calldns)
599 
600  if (calltcp)
602 
603  getCurrentTime();
604 
606 
607  return Comm::OK;
608  } while (timeout > current_dtime);
609  debugs(5, 8, "comm_select: time out: " << squid_curtime);
610 
611  return Comm::TIMEOUT;
612 }
613 
614 static void
616 {
617  int nfds = 0;
618  int fds[3];
619  int nevents;
620  dns_io_events = 0;
621 
622  if (DnsSocketA < 0 && DnsSocketB < 0)
623  return;
624 
625  if (DnsSocketA >= 0) {
626  fds[nfds] = DnsSocketA;
627  ++nfds;
628  }
629 
630  if (DnsSocketB >= 0) {
631  fds[nfds] = DnsSocketB;
632  ++nfds;
633  }
634 
635  nevents = comm_check_incoming_select_handlers(nfds, fds);
636 
637  if (nevents < 0)
638  return;
639 
640  incoming_dns_interval += Config.comm_incoming.dns.average - nevents;
641 
644 
647 
648  if (nevents > INCOMING_DNS_MAX)
649  nevents = INCOMING_DNS_MAX;
650 
652 }
653 
654 void
656 {
657  zero_tv.tv_sec = 0;
658  zero_tv.tv_usec = 0;
659  FD_ZERO(&global_readfds);
660  FD_ZERO(&global_writefds);
661  nreadfds = nwritefds = 0;
662 
663  Mgr::RegisterAction("comm_select_incoming",
664  "comm_incoming() stats",
665  commIncomingStats, 0, 1);
666 }
667 
668 /*
669  * examine_select - debug routine.
670  *
671  * I spend the day chasing this core dump that occurs when both the client
672  * and the server side of a cache fetch simultaneoulsy abort the
673  * connection. While I haven't really studied the code to figure out how
674  * it happens, the snippet below may prevent the cache from exitting:
675  *
676  * Call this from where the select loop fails.
677  */
678 static int
679 examine_select(fd_set * readfds, fd_set * writefds)
680 {
681  int fd = 0;
682  fd_set read_x;
683  fd_set write_x;
684 
685  struct timeval tv;
687  fde *F = NULL;
688 
689  struct stat sb;
690  debugs(5, DBG_CRITICAL, "examine_select: Examining open file descriptors...");
691 
692  for (fd = 0; fd < Squid_MaxFD; ++fd) {
693  FD_ZERO(&read_x);
694  FD_ZERO(&write_x);
695  tv.tv_sec = tv.tv_usec = 0;
696 
697  if (FD_ISSET(fd, readfds))
698  FD_SET(fd, &read_x);
699  else if (FD_ISSET(fd, writefds))
700  FD_SET(fd, &write_x);
701  else
702  continue;
703 
705  errno = 0;
706 
707  if (!fstat(fd, &sb)) {
708  debugs(5, 5, "FD " << fd << " is valid.");
709  continue;
710  }
711  int xerrno = errno;
712 
713  F = &fd_table[fd];
714  debugs(5, DBG_CRITICAL, "fstat(FD " << fd << "): " << xstrerr(xerrno));
715  debugs(5, DBG_CRITICAL, "WARNING: FD " << fd << " has handlers, but it's invalid.");
716  debugs(5, DBG_CRITICAL, "FD " << fd << " is a " << fdTypeStr[F->type] << " called '" << F->desc << "'");
717  debugs(5, DBG_CRITICAL, "tmout:" << F->timeoutHandler << " read:" << F->read_handler << " write:" << F->write_handler);
718 
719  for (ch = F->closeHandler; ch != NULL; ch = ch->Next())
720  debugs(5, DBG_CRITICAL, " close handler: " << ch);
721 
722  if (F->closeHandler != NULL) {
724  } else if (F->timeoutHandler != NULL) {
725  debugs(5, DBG_CRITICAL, "examine_select: Calling Timeout Handler");
727  }
728 
729  F->closeHandler = NULL;
730  F->timeoutHandler = NULL;
731  F->read_handler = NULL;
732  F->write_handler = NULL;
733  FD_CLR(fd, readfds);
734  FD_CLR(fd, writefds);
735  }
736 
737  return 0;
738 }
739 
740 static void
742 {
743  storeAppendPrintf(sentry, "Current incoming_udp_interval: %d\n",
745  storeAppendPrintf(sentry, "Current incoming_dns_interval: %d\n",
747  storeAppendPrintf(sentry, "Current incoming_tcp_interval: %d\n",
749  storeAppendPrintf(sentry, "\n");
750  storeAppendPrintf(sentry, "Histogram of events per incoming socket type\n");
751  storeAppendPrintf(sentry, "ICP Messages handled per comm_select_udp_incoming() call:\n");
753  storeAppendPrintf(sentry, "DNS Messages handled per comm_select_dns_incoming() call:\n");
755  storeAppendPrintf(sentry, "HTTP Messages handled per comm_select_tcp_incoming() call:\n");
757 }
758 
759 void
761 {
762  if (handler && !FD_ISSET(fd, &global_readfds)) {
763  FD_SET(fd, &global_readfds);
764  ++nreadfds;
765  } else if (!handler && FD_ISSET(fd, &global_readfds)) {
766  FD_CLR(fd, &global_readfds);
767  --nreadfds;
768  }
769 }
770 
771 void
773 {
774  if (handler && !FD_ISSET(fd, &global_writefds)) {
775  FD_SET(fd, &global_writefds);
776  ++nwritefds;
777  } else if (!handler && FD_ISSET(fd, &global_writefds)) {
778  FD_CLR(fd, &global_writefds);
779  --nwritefds;
780  }
781 }
782 
783 /* Called by async-io or diskd to speed up the polling */
784 void
786 {
787  MAX_POLL_TIME = 10;
788 }
789 
790 #endif /* USE_SELECT */
791 
#define FD_MASK_BYTES
Definition: ModSelect.cc:41
#define commCheckUdpIncoming
Definition: ModSelect.cc:118
void count(double val)
Definition: StatHist.cc:57
#define fd_table
Definition: fde.h:157
#define commCheckDnsIncoming
Definition: ModSelect.cc:119
#define COMM_SELECT_READ
Definition: defines.h:36
static int fdIsDns(int fd)
Definition: ModSelect.cc:161
StatCounters statCounter
Definition: StatCounters.cc:12
#define assert(EX)
Definition: assert.h:17
static int comm_check_incoming_select_handlers(int nfds, int *fds)
Definition: ModSelect.cc:184
int Squid_MaxFD
#define FD_MASK_BITS
Definition: ModSelect.cc:42
struct SquidConfig::@118::@125 tcp
static int examine_select(fd_set *, fd_set *)
Definition: ModSelect.cc:679
unsigned long fd_mask
Definition: types.h:154
static OBJH commIncomingStats
Definition: ModPoll.cc:58
Comm::ConnectionPointer icpIncomingConn
Definition: icp_v2.cc:102
void SelectLoopInit(void)
Initialize the module on Squid startup.
Definition: ModDevPoll.cc:178
struct fde::_fde_flags flags
StatHist comm_tcp_incoming
Definition: StatCounters.h:126
struct SquidConfig::@118::@125 udp
int type
Definition: errorpage.cc:78
static int fdIsUdpListener(int fd)
Definition: ModSelect.cc:149
static int incoming_tcp_interval
Definition: ModSelect.cc:117
int i
Definition: membanger.c:49
#define INCOMING_FACTOR
Definition: ModSelect.cc:110
static int MAX_POLL_TIME
Definition: ModSelect.cc:33
int maxfd
Definition: tcp-banger2.c:130
Definition: Flag.h:16
static int nreadfds
Definition: ModSelect.cc:58
static void comm_select_tcp_incoming(void)
Definition: ModSelect.cc:289
unsigned int type
Definition: fde.h:83
#define DBG_CRITICAL
Definition: Debug.h:45
static int tcp_io_events
Definition: ModSelect.cc:114
void OBJH(StoreEntry *)
Definition: forward.h:44
const char * fdTypeStr[]
Definition: fd.cc:40
AnyP::PortCfgPointer HttpPortList
list of Squid http(s)_port configured
Definition: PortCfg.cc:21
PF * write_handler
Definition: fde.h:128
static fd_set global_writefds
Definition: ModSelect.cc:57
time_t squid_curtime
Definition: stub_time.cc:17
AsyncCall::Pointer closeHandler
Definition: fde.h:134
static int fdIsTcpListener(int fd)
Definition: ModSelect.cc:173
static void comm_select_udp_incoming(void)
Definition: ModSelect.cc:252
int shutting_down
Definition: testAddress.cc:36
const char * xstrerr(int error)
Definition: xstrerror.cc:83
bool IsConnOpen(const Comm::ConnectionPointer &conn)
Definition: Connection.cc:24
static int incoming_udp_interval
Definition: ModSelect.cc:115
Comm::Flag DoSelect(int)
Do poll and trigger callback functions as appropriate.
Definition: ModDevPoll.cc:313
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:124
struct StatCounters::@136 syscalls
PF * read_handler
Definition: fde.h:126
#define DBG_IMPORTANT
Definition: Debug.h:46
void SetSelect(int, unsigned int, PF *, void *, time_t)
Mark an FD to be watched for its IO status.
Definition: ModDevPoll.cc:225
void RegisterAction(char const *action, char const *desc, OBJH *handler, int pw_req_flag, int atomic)
Definition: Registration.cc:16
#define EBIT_CLR(flag, bit)
Definition: defines.h:106
double select_time
Definition: StatCounters.h:120
int DnsSocketB
#define INCOMING_UDP_MAX
Definition: Loops.h:50
#define COMM_SELECT_WRITE
Definition: defines.h:37
StatHist comm_dns_incoming
Definition: StatCounters.h:125
void * write_data
Definition: fde.h:129
static void comm_select_dns_incoming(void)
Definition: ModSelect.cc:615
int incoming_sockets_accepted
static int nwritefds
Definition: ModSelect.cc:59
int Biggest_FD
StatHist select_fds_hist
Definition: StatCounters.h:127
void PF(int, void *)
Definition: forward.h:18
void * read_data
Definition: fde.h:127
static struct timeval zero_tv
Definition: ModSelect.cc:55
Comm::ConnectionPointer icpOutgoingConn
Definition: icp_v2.cc:104
unsigned long int select_loops
Definition: StatCounters.h:118
struct SquidConfig::@118 comm_incoming
#define MAXTCPLISTENPORTS
Definition: PortCfg.h:78
static void commUpdateWriteBits(int fd, PF *handler)
Definition: ModSelect.cc:772
static fd_set global_readfds
Definition: ModSelect.cc:56
static int incoming_dns_interval
Definition: ModSelect.cc:116
int DnsSocketA
static void commUpdateReadBits(int fd, PF *handler)
Definition: ModSelect.cc:760
static void handler(int signo)
Definition: purge.cc:860
std::ostream & HERE(std::ostream &s)
Definition: Debug.h:153
Flag
Definition: Flag.h:15
int ignoreErrno(int ierrno)
Definition: comm.cc:1477
time_t getCurrentTime(void)
Get current time.
#define commCheckTcpIncoming
Definition: ModSelect.cc:120
#define MAX_INCOMING_INTERVAL
Definition: ModSelect.cc:111
#define MYNAME
Definition: Debug.h:166
StatHist comm_udp_incoming
Definition: StatCounters.h:124
bool read_pending
Definition: fde.h:106
#define ScheduleCallHere(call)
Definition: AsyncCall.h:166
#define INCOMING_TCP_MAX
Definition: Loops.h:69
AsyncCall::Pointer timeoutHandler
Definition: fde.h:130
bool open
Definition: fde.h:96
static int udp_io_events
Definition: ModSelect.cc:112
double current_dtime
Definition: stub_time.cc:16
void commCallCloseHandlers(int fd)
Definition: comm.cc:719
Definition: fde.h:49
time_t timeout
Definition: fde.h:131
static int dns_io_events
Definition: ModSelect.cc:113
static uint32 F(uint32 X, uint32 Y, uint32 Z)
Definition: md4.c:46
#define howmany(x, y)
Definition: ModSelect.cc:36
void dump(StoreEntry *sentry, StatHistBinDumper *bd) const
Definition: StatHist.cc:173
char desc[FD_DESC_SZ]
Definition: fde.h:93
StatHistBinDumper statHistIntDumper
Definition: StatHist.h:119
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Definition: store.cc:875
struct SquidConfig::@118::@125 dns
#define EBIT_TEST(flag, bit)
Definition: defines.h:107
class SquidConfig Config
Definition: SquidConfig.cc:12
#define NULL
Definition: types.h:166
void QuickPollRequired(void)
Definition: ModDevPoll.cc:433
#define INCOMING_DNS_MAX
Definition: Loops.h:59
int nfds
Definition: tcp-banger2.c:129

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors