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