void
Comm::AcceptLimiter::defer(Comm::TcpAcceptor *afd)
{
- afd->isLimited++;
+ ++afd->isLimited;
debugs(5, 5, HERE << afd->conn << " x" << afd->isLimited);
deferred.push_back(afd);
}
void
Comm::AcceptLimiter::removeDead(const Comm::TcpAcceptor *afd)
{
- for (unsigned int i = 0; i < deferred.size() && afd->isLimited > 0; i++) {
+ for (unsigned int i = 0; i < deferred.size() && afd->isLimited > 0; ++i) {
if (deferred[i] == afd) {
deferred[i]->isLimited--;
deferred[i] = NULL; // fast. kick() will skip empty entries later.
{
// XXX: convert this to a std::map<> ?
iocb_table = static_cast<CbEntry*>(xcalloc(Squid_MaxFD, sizeof(CbEntry)));
- for (int pos = 0; pos < Squid_MaxFD; pos++) {
+ for (int pos = 0; pos < Squid_MaxFD; ++pos) {
iocb_table[pos].fd = pos;
iocb_table[pos].readcb.type = IOCB_READ;
iocb_table[pos].writecb.type = IOCB_WRITE;
Comm::CallbackTableDestruct()
{
// release any Comm::Connections being held.
- for (int pos = 0; pos < Squid_MaxFD; pos++) {
+ for (int pos = 0; pos < Squid_MaxFD; ++pos) {
iocb_table[pos].readcb.conn = NULL;
iocb_table[pos].writecb.conn = NULL;
}
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;
PROF_start(comm_handle_ready_fd);
- for (i = 0; i < num; i++) {
+ for (i = 0; i < num; ++i) {
int fd = (int)do_poll.dp_fds[i].fd;
F = &fd_table[fd];
debugs(
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,
PROF_start(comm_handle_ready_fd);
- for (i = 0, cevents = pevents; i < num; i++, cevents++) {
+ for (i = 0, cevents = pevents; i < num; ++i, ++cevents) {
fd = cevents->data.fd;
F = &fd_table[fd];
debugs(5, DEBUG_EPOLL ? 0 : 8, HERE << "got FD " << fd << " events=" <<
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.
kqoff = 0;
} else {
- kqoff++;
+ ++kqoff;
}
}
}
if (num == 0)
return COMM_OK; /* No error.. */
- for (i = 0; i < num; i++) {
+ for (i = 0; i < num; ++i) {
int fd = (int) ke[i].ident;
PF *hdl = NULL;
fde *F = &fd_table[fd];
pfds[npfds].fd = fd;
pfds[npfds].events = events;
pfds[npfds].revents = 0;
- npfds++;
+ ++npfds;
}
}
}
getCurrentTime();
- statCounter.syscalls.selects++;
+ ++statCounter.syscalls.selects;
if (poll(pfds, npfds, 0) < 1) {
PROF_stop(comm_check_incoming);
return incoming_sockets_accepted;
}
- for (i = 0; i < npfds; i++) {
+ for (i = 0; i < npfds; ++i) {
int revents;
if (((revents = pfds[i].revents) == 0) || ((fd = pfds[i].fd) == -1))
pfds[nfds].fd = i;
pfds[nfds].events = events;
pfds[nfds].revents = 0;
- nfds++;
+ ++nfds;
if ((events & POLLRDNORM) && fd_table[i].flags.read_pending)
- npending++;
+ ++npending;
}
}
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();
getCurrentTime();
- statCounter.syscalls.selects++;
+ ++statCounter.syscalls.selects;
if (select(maxfd, &read_mask, &write_mask, NULL, &zero_tv) < 1)
return incoming_sockets_accepted;
- for (i = 0; i < nfds; i++) {
+ for (i = 0; i < nfds; ++i) {
fd = fds[i];
if (FD_ISSET(fd, &read_mask)) {
if ( meta && (findings = meta->search( STORE_META_KEY_MD5 )) ) {
unsigned char* s = (unsigned char*) findings->data;
- for ( int j=0; j<16; j++, s++ ) {
+ for ( int j=0; j<16; ++j, ++s ) {
md5[j*2+0] = hexdigit[ *s >> 4 ];
md5[j*2+1] = hexdigit[ *s & 15 ];
}