Squid internals The comm loop (src/comm_select.c) Outline All non-disk IO goes through here Simple outline of comm_select() Handle any async disk IO callbacks Check FD timeouts once a second - checkTimeouts() Create a list of file descriptors which are waiting for IO (from their status in fd_table[]) Call poll() or select() to determine which FDs are ready Call the callback handlers registered on the ready FDs How IO happens .. /* Some part in code */ commSetSelect(fd, COMM_SELECT_READ, handlerfunc, handlerdata, timeout); .. /* Back to IO loop - comm_select() */ if (FD_ISSET(fd, &readfds)) /* If we're set for read */ F = &fd_table[fd]; /* Get a pointer to the fd state */ hdl = F->read_handler; /* Get the read handler callback ptr */ F->read_handler == NULL; /* Clear the read handler callback ptr */ hdl(fd, F->read_data); /* Call the read handler callback */ }