cn->pollno = -1;
cn->pollindex = allocate_pollindex(cn->fd, POLLIN); cn->rpollindex = -1;
static int accept_connection(struct server *s){	struct sockaddr_in sa_remote, sa_local;	socklen_t l;	int fd;	struct connection *cn;	do {		if (free_connections.head == 0 && waiting_connections.head == 0)			return 0;		l = sizeof sa_remote;		fd = accept(s->fd, (struct sockaddr *) &sa_remote, &l);		if (fd == -1) {			if (errno != EAGAIN) {				lerror("accept");				return -1;			}			return 0;		}		if (debug)			log_d("accept_connection: %d", fd);		fcntl(fd, F_SETFD, FD_CLOEXEC);		fcntl(fd, F_SETFL, O_NONBLOCK);		l = sizeof sa_local;		if (getsockname(fd, (struct sockaddr *) &sa_local, &l) == -1) {			lerror("getsockname");			close(fd);			break;		}		cn = find_connection();		if (cn == 0) {			log_d("connection to %s[%hu] dropped", inet_ntoa(sa_remote.sin_addr), ntohs(sa_remote.sin_port));			close(fd);		} else {			cn->s = s;			cn->fd = fd;			cn->rfd = -1;			cn->peer = sa_remote;			cn->sock = sa_local;			cn->t = current_time;			cn->pollno = -1;			++stats.nconnections;			if (stats.nconnections > stats.maxconnections)				stats.maxconnections = stats.nconnections;			init_connection(cn);			cn->logged = 0;			cn->header_input.start = cn->header_input.middle = cn->header_input.end = cn->header_input.floor;			set_connection_state(cn, HC_WAITING);		}	} while (tuning.accept_multi);	return 0;}