}
void httpd_main(void){	int rv;	int n, t;	time_t hours;	int accepting;	time_t last_time;	accepting = 1;	last_time = current_time = startuptime = time(0);	hours = current_time / 3600;	log_d("*** %s starting", server_version);	while (gotsigterm == 0) {		if (gotsighup) {			gotsighup = 0;			init_logs(0);			if (debug)				log_d("logs reopened");		}		if (gotsigusr1) {			gotsigusr1 = 0;			close_connections();			log_d("connections closed");		}		if (gotsigusr2) {			gotsigusr2 = 0;			close_servers();			log_d("servers closed");		}		if (gotsigchld) {			gotsigchld = 0;			reap_children();		}		if (gotsigquit) {			gotsigquit = 0;			debug = debug == 0;			if (debug)				log_d("debugging turned on");			else				log_d("debugging turned off");		}		if (gotsigwinch) {			gotsigwinch = 0;			log_d("performing internal dump");			internal_dump();		}		n = 0;		if (accepting && (free_connections.head || waiting_connections.head))			n = setup_server_pollfds(n);		n = setup_connection_pollfds(n);		n = setup_child_pollfds(n, forked_connections.head);		if (n == 0 && accepting) {			log_d("no more sockets to poll from");			break;		}		t = accepting ? (stats.nconnections ? 60000 : INFTIM) : 1000;		rv = poll(pollfds, n, t);		current_time = time(0);		if (rv == -1) {			if (errno != EINTR) {				lerror("poll");				break;			} else				continue;		}		if (current_time != last_time) {			if (accepting == 0)				accepting = 1;			last_time = current_time;			if (current_time / 3600 != hours) {				hours = current_time / 3600;				init_logs(0);				if (debug)					log_d("logs rotated");			}		}		if (rv) {			if (accepting && run_servers() == -1)				accepting = 0;			run_connections();		}		cleanup_connections();	}	log_d("*** shutting down");}