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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors