src/session.c
static void kill_mini_session(struct session *s)
{
	int level = LOG_INFO;
	struct connection *conn = s->si[0].conn;
	unsigned int log = s->logs.logwait;
	const char *err_msg;

	if (s->fe->options2 & PR_O2_LOGERRORS)
		level = LOG_ERR;

	if (log && (s->fe->options & PR_O_NULLNOLOG)) {
		/* with "option dontlognull", we don't log connections with no transfer */
		if (!conn->err_code ||
		    conn->err_code == CO_ER_PRX_EMPTY || conn->err_code == CO_ER_PRX_ABORT ||
		    conn->err_code == CO_ER_SSL_EMPTY || conn->err_code == CO_ER_SSL_ABORT)
			log = 0;
	}

	if (log) {
		if (!conn->err_code && (s->task->state & TASK_WOKEN_TIMER)) {
			if (conn->flags & CO_FL_ACCEPT_PROXY)
				conn->err_code = CO_ER_PRX_TIMEOUT;
			else if (conn->flags & CO_FL_SSL_WAIT_HS)
				conn->err_code = CO_ER_SSL_TIMEOUT;
		}

		prepare_mini_sess_log_prefix(s);
		err_msg = conn_err_code_str(conn);
		if (err_msg)
			send_log(s->fe, level, "%s: %s\n", trash.str, err_msg);
		else
			send_log(s->fe, level, "%s: unknown connection error (code=%d flags=%08x)\n",
				 trash.str, conn->err_code, conn->flags);
	}

	/* kill the connection now */
	conn_full_close(s->si[0].conn);

	s->fe->feconn--;
	if (s->stkctr[0].entry || s->stkctr[1].entry)
		session_store_counters(s);

	if (!(s->listener->options & LI_O_UNLIMITED))
		actconn--;
	jobs--;
	s->listener->nbconn--;
	if (s->listener->state == LI_FULL)
		resume_listener(s->listener);

	/* Dequeues all of the listeners waiting for a resource */
	if (!LIST_ISEMPTY(&global_listener_queue))
		dequeue_all_listeners(&global_listener_queue);

	if (!LIST_ISEMPTY(&s->fe->listener_queue) &&
	    (!s->fe->fe_sps_lim || freq_ctr_remain(&s->fe->fe_sess_per_sec, s->fe->fe_sps_lim, 0) > 0))
		dequeue_all_listeners(&s->fe->listener_queue);

	task_delete(s->task);
	task_free(s->task);

	pool_free2(pool2_connection, s->si[1].conn);
	pool_free2(pool2_connection, s->si[0].conn);
	pool_free2(pool2_session, s);
}
/* This function kills an existing embryonic session. It stops the connection's
 * transport layer, releases assigned resources, resumes the listener if it was
 * disabled and finally kills the file descriptor.
 */
This function kills an existing embryonic session. It stops the connection's
transport layer, releases assigned resources, resumes the listener if it was
disabled and finally kills the file descriptor.
This function kills an existing embryonic session . It stops the connection ' s transport layer releases assigned resources resumes the listener if it was disabled and finally kills the file descriptor .
static void kill_mini_session(struct session *s)
{
	int level = LOG_INFO;
	struct connection *conn = s->si[0].conn;
	unsigned int log = s->logs.logwait;
	const char *err_msg;
	if (s->fe->options2 & PR_O2_LOGERRORS)
		level = LOG_ERR;
	if (log && (s->fe->options & PR_O_NULLNOLOG)) {
		if (!conn->err_code ||
		    conn->err_code == CO_ER_PRX_EMPTY || conn->err_code == CO_ER_PRX_ABORT ||
		    conn->err_code == CO_ER_SSL_EMPTY || conn->err_code == CO_ER_SSL_ABORT)
			log = 0;
	}
	if (log) {
		if (!conn->err_code && (s->task->state & TASK_WOKEN_TIMER)) {
			if (conn->flags & CO_FL_ACCEPT_PROXY)
				conn->err_code = CO_ER_PRX_TIMEOUT;
			else if (conn->flags & CO_FL_SSL_WAIT_HS)
				conn->err_code = CO_ER_SSL_TIMEOUT;
		}
		prepare_mini_sess_log_prefix(s);
		err_msg = conn_err_code_str(conn);
		if (err_msg)
			send_log(s->fe, level, "%s: %s\n", trash.str, err_msg);
		else
			send_log(s->fe, level, "%s: unknown connection error (code=%d flags=%08x)\n",
				 trash.str, conn->err_code, conn->flags);
	}
	conn_full_close(s->si[0].conn);
	s->fe->feconn--;
	if (s->stkctr[0].entry || s->stkctr[1].entry)
		session_store_counters(s);
	if (!(s->listener->options & LI_O_UNLIMITED))
		actconn--;
	jobs--;
	s->listener->nbconn--;
	if (s->listener->state == LI_FULL)
		resume_listener(s->listener);
	if (!LIST_ISEMPTY(&global_listener_queue))
		dequeue_all_listeners(&global_listener_queue);
	if (!LIST_ISEMPTY(&s->fe->listener_queue) &&
	    (!s->fe->fe_sps_lim || freq_ctr_remain(&s->fe->fe_sess_per_sec, s->fe->fe_sps_lim, 0) > 0))
		dequeue_all_listeners(&s->fe->listener_queue);
	task_delete(s->task);
	task_free(s->task);
	pool_free2(pool2_connection, s->si[1].conn);
	pool_free2(pool2_connection, s->si[0].conn);
	pool_free2(pool2_session, s);
}
static void kill_mini_session ( struct session * s ) { int level = LOG_INFO ; struct connection * conn = s -> si [ 0 ] . conn ; unsigned int log = s -> logs . logwait ; const char * err_msg ; if ( s -> fe -> options2 & PR_O2_LOGERRORS ) level = LOG_ERR ; if ( log && ( s -> fe -> options & PR_O_NULLNOLOG ) ) { if ( ! conn -> err_code || conn -> err_code == CO_ER_PRX_EMPTY || conn -> err_code == CO_ER_PRX_ABORT || conn -> err_code == CO_ER_SSL_EMPTY || conn -> err_code == CO_ER_SSL_ABORT ) log = 0 ; } if ( log ) { if ( ! conn -> err_code && ( s -> task -> state & TASK_WOKEN_TIMER ) ) { if ( conn -> flags & CO_FL_ACCEPT_PROXY ) conn -> err_code = CO_ER_PRX_TIMEOUT ; else if ( conn -> flags & CO_FL_SSL_WAIT_HS ) conn -> err_code = CO_ER_SSL_TIMEOUT ; } prepare_mini_sess_log_prefix ( s ) ; err_msg = conn_err_code_str ( conn ) ; if ( err_msg ) send_log ( s -> fe , level , " \n " , trash . str , err_msg ) ; else send_log ( s -> fe , level , " \n " , trash . str , conn -> err_code , conn -> flags ) ; } conn_full_close ( s -> si [ 0 ] . conn ) ; s -> fe -> feconn -- ; if ( s -> stkctr [ 0 ] . entry || s -> stkctr [ 1 ] . entry ) session_store_counters ( s ) ; if ( ! ( s -> listener -> options & LI_O_UNLIMITED ) ) actconn -- ; jobs -- ; s -> listener -> nbconn -- ; if ( s -> listener -> state == LI_FULL ) resume_listener ( s -> listener ) ; if ( ! LIST_ISEMPTY ( & global_listener_queue ) ) dequeue_all_listeners ( & global_listener_queue ) ; if ( ! LIST_ISEMPTY ( & s -> fe -> listener_queue ) && ( ! s -> fe -> fe_sps_lim || freq_ctr_remain ( & s -> fe -> fe_sess_per_sec , s -> fe -> fe_sps_lim , 0 ) > 0 ) ) dequeue_all_listeners ( & s -> fe -> listener_queue ) ; task_delete ( s -> task ) ; task_free ( s -> task ) ; pool_free2 ( pool2_connection , s -> si [ 1 ] . conn ) ; pool_free2 ( pool2_connection , s -> si [ 0 ] . conn ) ; pool_free2 ( pool2_session , s ) ; }
This function kills an existing embryonic session.
This function kills an existing embryonic session .
/* with "option dontlognull", we don't log connections with no transfer */ /* kill the connection now */ /* Dequeues all of the listeners waiting for a resource */