void
Comm::AcceptLimiter::defer(Comm::TcpAcceptor *afd)
{
- ++afd->isLimited;
+ ++ afd->isLimited;
debugs(5, 5, HERE << afd->conn << " x" << afd->isLimited);
deferred.push_back(afd);
}
{
for (unsigned int i = 0; i < deferred.size() && afd->isLimited > 0; ++i) {
if (deferred[i] == afd) {
- deferred[i]->isLimited--;
+ -- deferred[i]->isLimited;
deferred[i] = NULL; // fast. kick() will skip empty entries later.
debugs(5, 5, HERE << afd->conn << " x" << afd->isLimited);
}
TcpAcceptor *temp = deferred.shift();
if (temp != NULL) {
debugs(5, 5, HERE << " doing one.");
- temp->isLimited--;
+ -- temp->isLimited;
temp->acceptNext();
break;
}
comm_flush_updates();
/* Push new event onto array */
- ++devpoll_update.cur;
+ ++ devpoll_update.cur;
devpoll_update.pfds[devpoll_update.cur].fd = fd;
devpoll_update.pfds[devpoll_update.cur].events = events;
devpoll_update.pfds[devpoll_update.cur].revents = 0;
comm_flush_updates(); /* ensure latest changes are sent to /dev/poll */
num = ioctl(devpoll_fd, DP_POLL, &do_poll);
- ++statCounter.select_loops;
+ ++ statCounter.select_loops;
if (num >= 0)
break; /* no error, skip out of loop */
F->read_handler = NULL;
hdl(fd, F->read_data);
PROF_stop(comm_read_handler);
- ++statCounter.select_fds;
+ ++ statCounter.select_fds;
} else {
debugs(
5,
F->write_handler = NULL;
hdl(fd, F->write_data);
PROF_stop(comm_write_handler);
- ++statCounter.select_fds;
+ ++ statCounter.select_fds;
} else {
debugs(
5,
for (;;) {
num = epoll_wait(kdpfd, pevents, SQUID_MAXFD, msec);
- ++statCounter.select_loops;
+ ++ statCounter.select_loops;
if (num >= 0)
break;
F->read_handler = NULL;
hdl(fd, F->read_data);
PROF_stop(comm_write_handler);
- ++statCounter.select_fds;
+ ++ statCounter.select_fds;
} else {
debugs(5, DEBUG_EPOLL ? 0 : 8, HERE << "no read handler for FD " << fd);
// remove interest since no handler exist for this event.
F->write_handler = NULL;
hdl(fd, F->write_data);
PROF_stop(comm_read_handler);
- ++statCounter.select_fds;
+ ++ statCounter.select_fds;
} else {
debugs(5, DEBUG_EPOLL ? 0 : 8, HERE << "no write handler for FD " << fd);
// remove interest since no handler exist for this event.
PROF_start(comm_check_incoming);
incoming_sockets_accepted = 0;
- for (i = npfds = 0; i < nfds; i++) {
+ for (i = npfds = 0; i < nfds; ++i) {
int events;
fd = fds[i];
events = 0;
}
getCurrentTime();
- ++statCounter.syscalls.selects;
+ ++ statCounter.syscalls.selects;
if (poll(pfds, npfds, 0) < 1) {
PROF_stop(comm_check_incoming);
int nevents;
udp_io_events = 0;
- if (Comm::IsConnOpen(icpIncomingConn))
- fds[nfds++] = icpIncomingConn->fd;
+ if (Comm::IsConnOpen(icpIncomingConn)) {
+ fds[nfds] = icpIncomingConn->fd;
+ ++nfds;
+ }
- if (icpIncomingConn != icpOutgoingConn && Comm::IsConnOpen(icpOutgoingConn))
- fds[nfds++] = icpOutgoingConn->fd;
+ if (icpIncomingConn != icpOutgoingConn && Comm::IsConnOpen(icpOutgoingConn)) {
+ fds[nfds] = icpOutgoingConn->fd;
+ ++nfds;
+ }
if (nfds == 0)
return;
// XXX: only poll sockets that won't be deferred. But how do we identify them?
- for (j = 0; j < NHttpSockets; j++) {
+ for (j = 0; j < NHttpSockets; ++j) {
if (HttpSockets[j] < 0)
continue;
- fds[nfds++] = HttpSockets[j];
+ fds[nfds] = HttpSockets[j];
+ ++nfds;
}
nevents = comm_check_incoming_poll_handlers(nfds, fds);
maxfd = Biggest_FD + 1;
- for (int i = 0; i < maxfd; i++) {
+ for (int i = 0; i < maxfd; ++i) {
int events;
events = 0;
/* Check each open socket for a handler. */
for (;;) {
PROF_start(comm_poll_normal);
- ++statCounter.syscalls.selects;
+ ++ statCounter.syscalls.selects;
num = poll(pfds, nfds, msec);
- ++statCounter.select_loops;
+ ++ statCounter.select_loops;
PROF_stop(comm_poll_normal);
if (num >= 0 || npending > 0)
* limit in SunOS */
PROF_start(comm_handle_ready_fd);
- for (size_t loopIndex = 0; loopIndex < nfds; loopIndex++) {
+ for (size_t loopIndex = 0; loopIndex < nfds; ++loopIndex) {
fde *F;
int revents = pfds[loopIndex].revents;
fd = pfds[loopIndex].fd;
F->flags.read_pending = 0;
hdl(fd, F->read_data);
PROF_stop(comm_read_handler);
- ++statCounter.select_fds;
+ ++ statCounter.select_fds;
if (commCheckUdpIncoming)
comm_poll_udp_incoming();
F->write_handler = NULL;
hdl(fd, F->write_data);
PROF_stop(comm_write_handler);
- ++statCounter.select_fds;
+ ++ statCounter.select_fds;
if (commCheckUdpIncoming)
comm_poll_udp_incoming();
if (DnsSocketA < 0 && DnsSocketB < 0)
return;
- if (DnsSocketA >= 0)
- fds[nfds++] = DnsSocketA;
+ if (DnsSocketA >= 0) {
+ fds[nfds] = DnsSocketA;
+ ++nfds;
+ }
- if (DnsSocketB >= 0)
- fds[nfds++] = DnsSocketB;
+ if (DnsSocketB >= 0) {
+ fds[nfds] = DnsSocketB;
+ ++nfds;
+ }
nevents = comm_check_incoming_poll_handlers(nfds, fds);