ModSelect.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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);
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 void
149 Comm::ResetSelect(int fd)
150 {
151 }
152 
153 static int
155 {
156  if (icpIncomingConn != NULL && fd == icpIncomingConn->fd)
157  return 1;
158 
159  if (icpOutgoingConn != NULL && fd == icpOutgoingConn->fd)
160  return 1;
161 
162  return 0;
163 }
164 
165 static int
166 fdIsDns(int fd)
167 {
168  if (fd == DnsSocketA)
169  return 1;
170 
171  if (fd == DnsSocketB)
172  return 1;
173 
174  return 0;
175 }
176 
177 static int
179 {
180  for (AnyP::PortCfgPointer s = HttpPortList; s != NULL; s = s->next) {
181  if (s->listenConn != NULL && s->listenConn->fd == fd)
182  return 1;
183  }
184 
185  return 0;
186 }
187 
188 static int
190 {
191  int i;
192  int fd;
193  int maxfd = 0;
194  PF *hdl = NULL;
195  fd_set read_mask;
196  fd_set write_mask;
197  FD_ZERO(&read_mask);
198  FD_ZERO(&write_mask);
200 
201  for (i = 0; i < nfds; ++i) {
202  fd = fds[i];
203 
204  if (fd_table[fd].read_handler) {
205  FD_SET(fd, &read_mask);
206 
207  if (fd > maxfd)
208  maxfd = fd;
209  }
210 
211  if (fd_table[fd].write_handler) {
212  FD_SET(fd, &write_mask);
213 
214  if (fd > maxfd)
215  maxfd = fd;
216  }
217  }
218 
219  if (maxfd++ == 0)
220  return -1;
221 
222  getCurrentTime();
223 
225 
226  if (select(maxfd, &read_mask, &write_mask, NULL, &zero_tv) < 1)
228 
229  for (i = 0; i < nfds; ++i) {
230  fd = fds[i];
231 
232  if (FD_ISSET(fd, &read_mask)) {
233  if ((hdl = fd_table[fd].read_handler) != NULL) {
234  fd_table[fd].read_handler = NULL;
236  hdl(fd, fd_table[fd].read_data);
237  } else {
238  debugs(5, DBG_IMPORTANT, "comm_select_incoming: FD " << fd << " NULL read handler");
239  }
240  }
241 
242  if (FD_ISSET(fd, &write_mask)) {
243  if ((hdl = fd_table[fd].write_handler) != NULL) {
244  fd_table[fd].write_handler = NULL;
246  hdl(fd, fd_table[fd].write_data);
247  } else {
248  debugs(5, DBG_IMPORTANT, "comm_select_incoming: FD " << fd << " NULL write handler");
249  }
250  }
251  }
252 
254 }
255 
256 static void
258 {
259  int nfds = 0;
260  int fds[2];
261  int nevents;
262  udp_io_events = 0;
263 
265  fds[nfds] = icpIncomingConn->fd;
266  ++nfds;
267  }
268 
270  fds[nfds] = icpOutgoingConn->fd;
271  ++nfds;
272  }
273 
274  if (nfds == 0)
275  return;
276 
277  nevents = comm_check_incoming_select_handlers(nfds, fds);
278 
279  incoming_udp_interval += Config.comm_incoming.udp.average - nevents;
280 
281  if (incoming_udp_interval < 0)
283 
286 
287  if (nevents > INCOMING_UDP_MAX)
288  nevents = INCOMING_UDP_MAX;
289 
291 }
292 
293 static void
295 {
296  int nfds = 0;
297  int fds[MAXTCPLISTENPORTS];
298  int nevents;
299  tcp_io_events = 0;
300 
301  // XXX: only poll sockets that won't be deferred. But how do we identify them?
302 
303  for (AnyP::PortCfgPointer s = HttpPortList; s != NULL; s = s->next) {
304  if (Comm::IsConnOpen(s->listenConn)) {
305  fds[nfds] = s->listenConn->fd;
306  ++nfds;
307  }
308  }
309 
310  nevents = comm_check_incoming_select_handlers(nfds, fds);
311  incoming_tcp_interval += Config.comm_incoming.tcp.average - nevents;
312 
313  if (incoming_tcp_interval < 0)
315 
318 
319  if (nevents > INCOMING_TCP_MAX)
320  nevents = INCOMING_TCP_MAX;
321 
323 }
324 
325 #define DEBUG_FDBITS 0
326 /* Select on all sockets; call handlers for those that are ready. */
328 Comm::DoSelect(int msec)
329 {
330  fd_set readfds;
331  fd_set pendingfds;
332  fd_set writefds;
333 
334  PF *hdl = NULL;
335  int fd;
336  int maxfd;
337  int num;
338  int pending;
339  int calldns = 0, calludp = 0, calltcp = 0;
340  int maxindex;
341  unsigned int k;
342  int j;
343 #if DEBUG_FDBITS
344 
345  int i;
346 #endif
347 
348  fd_mask *fdsp;
349  fd_mask *pfdsp;
350  fd_mask tmask;
351 
352  struct timeval poll_time;
353  double timeout = current_dtime + (msec / 1000.0);
354  fde *F;
355 
356  do {
357  double start;
358  getCurrentTime();
359  start = current_dtime;
360 
363 
366 
369 
370  calldns = calludp = calltcp = 0;
371 
372  maxfd = Biggest_FD + 1;
373 
374  memcpy(&readfds, &global_readfds,
376 
377  memcpy(&writefds, &global_writefds,
378  howmany(maxfd, FD_MASK_BITS) * FD_MASK_BYTES);
379 
380  /* remove stalled FDs, and deal with pending descriptors */
381  pending = 0;
382 
383  FD_ZERO(&pendingfds);
384 
385  maxindex = howmany(maxfd, FD_MASK_BITS);
386 
387  fdsp = (fd_mask *) & readfds;
388 
389  for (j = 0; j < maxindex; ++j) {
390  if ((tmask = fdsp[j]) == 0)
391  continue; /* no bits here */
392 
393  for (k = 0; k < FD_MASK_BITS; ++k) {
394  if (!EBIT_TEST(tmask, k))
395  continue;
396 
397  /* Found a set bit */
398  fd = (j * FD_MASK_BITS) + k;
399 
400  if (FD_ISSET(fd, &readfds) && fd_table[fd].flags.read_pending) {
401  FD_SET(fd, &pendingfds);
402  ++pending;
403  }
404  }
405  }
406 
407 #if DEBUG_FDBITS
408  for (i = 0; i < maxfd; ++i) {
409  /* Check each open socket for a handler. */
410 
411  if (fd_table[i].read_handler) {
412  assert(FD_ISSET(i, &readfds));
413  }
414 
415  if (fd_table[i].write_handler) {
416  assert(FD_ISSET(i, &writefds));
417  }
418  }
419 
420 #endif
421  if (nreadfds + nwritefds == 0) {
423  return Comm::SHUTDOWN;
424  }
425 
426  if (msec > MAX_POLL_TIME)
427  msec = MAX_POLL_TIME;
428 
429  if (pending)
430  msec = 0;
431 
432  for (;;) {
433  poll_time.tv_sec = msec / 1000;
434  poll_time.tv_usec = (msec % 1000) * 1000;
436  num = select(maxfd, &readfds, &writefds, NULL, &poll_time);
437  int xerrno = errno;
439 
440  if (num >= 0 || pending > 0)
441  break;
442 
443  if (ignoreErrno(xerrno))
444  break;
445 
446  debugs(5, DBG_CRITICAL, MYNAME << "select failure: " << xstrerr(xerrno));
447 
448  examine_select(&readfds, &writefds);
449 
450  return Comm::COMM_ERROR;
451 
452  /* NOTREACHED */
453  }
454 
455  if (num < 0 && !pending)
456  continue;
457 
458  getCurrentTime();
459 
460  debugs(5, num ? 5 : 8, "comm_select: " << num << "+" << pending << " FDs ready");
461 
463 
464  if (num == 0 && pending == 0)
465  continue;
466 
467  /* Scan return fd masks for ready descriptors */
468  fdsp = (fd_mask *) & readfds;
469 
470  pfdsp = (fd_mask *) & pendingfds;
471 
472  maxindex = howmany(maxfd, FD_MASK_BITS);
473 
474  for (j = 0; j < maxindex; ++j) {
475  if ((tmask = (fdsp[j] | pfdsp[j])) == 0)
476  continue; /* no bits here */
477 
478  for (k = 0; k < FD_MASK_BITS; ++k) {
479  if (tmask == 0)
480  break; /* no more bits left */
481 
482  if (!EBIT_TEST(tmask, k))
483  continue;
484 
485  /* Found a set bit */
486  fd = (j * FD_MASK_BITS) + k;
487 
488  EBIT_CLR(tmask, k); /* this will be done */
489 
490 #if DEBUG_FDBITS
491 
492  debugs(5, 9, "FD " << fd << " bit set for reading");
493 
494  assert(FD_ISSET(fd, &readfds));
495 
496 #endif
497 
498  if (fdIsUdpListener(fd)) {
499  calludp = 1;
500  continue;
501  }
502 
503  if (fdIsDns(fd)) {
504  calldns = 1;
505  continue;
506  }
507 
508  if (fdIsTcpListener(fd)) {
509  calltcp = 1;
510  continue;
511  }
512 
513  F = &fd_table[fd];
514  debugs(5, 6, "comm_select: FD " << fd << " ready for reading");
515 
516  if (NULL == (hdl = F->read_handler))
517  (void) 0;
518  else {
519  F->read_handler = NULL;
520  F->flags.read_pending = 0;
522  hdl(fd, F->read_data);
524 
527 
530 
533  }
534  }
535  }
536 
537  fdsp = (fd_mask *) & writefds;
538 
539  for (j = 0; j < maxindex; ++j) {
540  if ((tmask = fdsp[j]) == 0)
541  continue; /* no bits here */
542 
543  for (k = 0; k < FD_MASK_BITS; ++k) {
544  if (tmask == 0)
545  break; /* no more bits left */
546 
547  if (!EBIT_TEST(tmask, k))
548  continue;
549 
550  /* Found a set bit */
551  fd = (j * FD_MASK_BITS) + k;
552 
553  EBIT_CLR(tmask, k); /* this will be done */
554 
555 #if DEBUG_FDBITS
556 
557  debugs(5, 9, "FD " << fd << " bit set for writing");
558 
559  assert(FD_ISSET(fd, &writefds));
560 
561 #endif
562 
563  if (fdIsUdpListener(fd)) {
564  calludp = 1;
565  continue;
566  }
567 
568  if (fdIsDns(fd)) {
569  calldns = 1;
570  continue;
571  }
572 
573  if (fdIsTcpListener(fd)) {
574  calltcp = 1;
575  continue;
576  }
577 
578  F = &fd_table[fd];
579  debugs(5, 6, "comm_select: FD " << fd << " ready for writing");
580 
581  if ((hdl = F->write_handler)) {
582  F->write_handler = NULL;
584  hdl(fd, F->write_data);
586 
589 
592 
595  }
596  }
597  }
598 
599  if (calludp)
601 
602  if (calldns)
604 
605  if (calltcp)
607 
608  getCurrentTime();
609 
611 
612  return Comm::OK;
613  } while (timeout > current_dtime);
614  debugs(5, 8, "comm_select: time out: " << squid_curtime);
615 
616  return Comm::TIMEOUT;
617 }
618 
619 static void
621 {
622  int nfds = 0;
623  int fds[3];
624  int nevents;
625  dns_io_events = 0;
626 
627  if (DnsSocketA < 0 && DnsSocketB < 0)
628  return;
629 
630  if (DnsSocketA >= 0) {
631  fds[nfds] = DnsSocketA;
632  ++nfds;
633  }
634 
635  if (DnsSocketB >= 0) {
636  fds[nfds] = DnsSocketB;
637  ++nfds;
638  }
639 
640  nevents = comm_check_incoming_select_handlers(nfds, fds);
641 
642  if (nevents < 0)
643  return;
644 
645  incoming_dns_interval += Config.comm_incoming.dns.average - nevents;
646 
649 
652 
653  if (nevents > INCOMING_DNS_MAX)
654  nevents = INCOMING_DNS_MAX;
655 
657 }
658 
659 void
661 {
662  zero_tv.tv_sec = 0;
663  zero_tv.tv_usec = 0;
664  FD_ZERO(&global_readfds);
665  FD_ZERO(&global_writefds);
666  nreadfds = nwritefds = 0;
667 
668  Mgr::RegisterAction("comm_select_incoming",
669  "comm_incoming() stats",
670  commIncomingStats, 0, 1);
671 }
672 
673 /*
674  * examine_select - debug routine.
675  *
676  * I spend the day chasing this core dump that occurs when both the client
677  * and the server side of a cache fetch simultaneoulsy abort the
678  * connection. While I haven't really studied the code to figure out how
679  * it happens, the snippet below may prevent the cache from exitting:
680  *
681  * Call this from where the select loop fails.
682  */
683 static int
684 examine_select(fd_set * readfds, fd_set * writefds)
685 {
686  int fd = 0;
687  fd_set read_x;
688  fd_set write_x;
689 
690  struct timeval tv;
692  fde *F = NULL;
693 
694  struct stat sb;
695  debugs(5, DBG_CRITICAL, "examine_select: Examining open file descriptors...");
696 
697  for (fd = 0; fd < Squid_MaxFD; ++fd) {
698  FD_ZERO(&read_x);
699  FD_ZERO(&write_x);
700  tv.tv_sec = tv.tv_usec = 0;
701 
702  if (FD_ISSET(fd, readfds))
703  FD_SET(fd, &read_x);
704  else if (FD_ISSET(fd, writefds))
705  FD_SET(fd, &write_x);
706  else
707  continue;
708 
710  errno = 0;
711 
712  if (!fstat(fd, &sb)) {
713  debugs(5, 5, "FD " << fd << " is valid.");
714  continue;
715  }
716  int xerrno = errno;
717 
718  F = &fd_table[fd];
719  debugs(5, DBG_CRITICAL, "fstat(FD " << fd << "): " << xstrerr(xerrno));
720  debugs(5, DBG_CRITICAL, "WARNING: FD " << fd << " has handlers, but it's invalid.");
721  debugs(5, DBG_CRITICAL, "FD " << fd << " is a " << fdTypeStr[F->type] << " called '" << F->desc << "'");
722  debugs(5, DBG_CRITICAL, "tmout:" << F->timeoutHandler << " read:" << F->read_handler << " write:" << F->write_handler);
723 
724  for (ch = F->closeHandler; ch != NULL; ch = ch->Next())
725  debugs(5, DBG_CRITICAL, " close handler: " << ch);
726 
727  if (F->closeHandler != NULL) {
729  } else if (F->timeoutHandler != NULL) {
730  debugs(5, DBG_CRITICAL, "examine_select: Calling Timeout Handler");
732  }
733 
734  F->closeHandler = NULL;
735  F->timeoutHandler = NULL;
736  F->read_handler = NULL;
737  F->write_handler = NULL;
738  FD_CLR(fd, readfds);
739  FD_CLR(fd, writefds);
740  }
741 
742  return 0;
743 }
744 
745 static void
747 {
748  storeAppendPrintf(sentry, "Current incoming_udp_interval: %d\n",
750  storeAppendPrintf(sentry, "Current incoming_dns_interval: %d\n",
752  storeAppendPrintf(sentry, "Current incoming_tcp_interval: %d\n",
754  storeAppendPrintf(sentry, "\n");
755  storeAppendPrintf(sentry, "Histogram of events per incoming socket type\n");
756  storeAppendPrintf(sentry, "ICP Messages handled per comm_select_udp_incoming() call:\n");
758  storeAppendPrintf(sentry, "DNS Messages handled per comm_select_dns_incoming() call:\n");
760  storeAppendPrintf(sentry, "HTTP Messages handled per comm_select_tcp_incoming() call:\n");
762 }
763 
764 void
766 {
767  if (handler && !FD_ISSET(fd, &global_readfds)) {
768  FD_SET(fd, &global_readfds);
769  ++nreadfds;
770  } else if (!handler && FD_ISSET(fd, &global_readfds)) {
771  FD_CLR(fd, &global_readfds);
772  --nreadfds;
773  }
774 }
775 
776 void
778 {
779  if (handler && !FD_ISSET(fd, &global_writefds)) {
780  FD_SET(fd, &global_writefds);
781  ++nwritefds;
782  } else if (!handler && FD_ISSET(fd, &global_writefds)) {
783  FD_CLR(fd, &global_writefds);
784  --nwritefds;
785  }
786 }
787 
788 /* Called by async-io or diskd to speed up the polling */
789 void
791 {
792  MAX_POLL_TIME = 10;
793 }
794 
795 #endif /* USE_SELECT */
796 
#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:166
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:189
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:684
unsigned long fd_mask
Definition: types.h:154
Comm::ConnectionPointer icpIncomingConn
Definition: icp_v2.cc:71
void ResetSelect(int)
reset/undo/unregister the watch for an FD which was set by Comm::SetSelect()
Definition: ModDevPoll.cc:304
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:79
static int fdIsUdpListener(int fd)
Definition: ModSelect.cc:154
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:294
unsigned int type
Definition: fde.h:83
#define DBG_CRITICAL
Definition: Debug.h:44
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:178
static void comm_select_udp_incoming(void)
Definition: ModSelect.cc:257
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:324
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:123
struct StatCounters::@136 syscalls
PF * read_handler
Definition: fde.h:126
#define DBG_IMPORTANT
Definition: Debug.h:45
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:45
#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:620
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:73
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:777
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:765
static void handler(int signo)
Definition: purge.cc:860
std::ostream & HERE(std::ostream &s)
Definition: Debug.h:147
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:160
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:64
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:123
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Definition: store.cc:904
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:444
static OBJH commIncomingStats
Definition: ModSelect.cc:49
#define INCOMING_DNS_MAX
Definition: Loops.h:54
int nfds
Definition: tcp-banger2.c:129

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors