src/session.c
void sess_change_server(struct session *sess, struct server *newsrv)
{
	if (sess->srv_conn == newsrv)
		return;

	if (sess->srv_conn) {
		sess->srv_conn->served--;
		if (sess->srv_conn->proxy->lbprm.server_drop_conn)
			sess->srv_conn->proxy->lbprm.server_drop_conn(sess->srv_conn);
		session_del_srv_conn(sess);
	}

	if (newsrv) {
		newsrv->served++;
		if (newsrv->proxy->lbprm.server_take_conn)
			newsrv->proxy->lbprm.server_take_conn(newsrv);
		session_add_srv_conn(sess, newsrv);
	}
}
/*
 * This function adjusts sess->srv_conn and maintains the previous and new
 * server's served session counts. Setting newsrv to NULL is enough to release
 * current connection slot. This function also notifies any LB algo which might
 * expect to be informed about any change in the number of active sessions on a
 * server.
 */
This function adjusts sess->srv_conn and maintains the previous and new
server's served session counts. Setting newsrv to NULL is enough to release
current connection slot. This function also notifies any LB algo which might
expect to be informed about any change in the number of active sessions on a
server.
This function adjusts sess - > srv_conn and maintains the previous and new server ' s served session counts . Setting newsrv to NULL is enough to release current connection slot . This function also notifies any LB algo which might expect to be informed about any change in the number of active sessions on a server .
void sess_change_server(struct session *sess, struct server *newsrv)
{
	if (sess->srv_conn == newsrv)
		return;
	if (sess->srv_conn) {
		sess->srv_conn->served--;
		if (sess->srv_conn->proxy->lbprm.server_drop_conn)
			sess->srv_conn->proxy->lbprm.server_drop_conn(sess->srv_conn);
		session_del_srv_conn(sess);
	}
	if (newsrv) {
		newsrv->served++;
		if (newsrv->proxy->lbprm.server_take_conn)
			newsrv->proxy->lbprm.server_take_conn(newsrv);
		session_add_srv_conn(sess, newsrv);
	}
}
void sess_change_server ( struct session * sess , struct server * newsrv ) { if ( sess -> srv_conn == newsrv ) return ; if ( sess -> srv_conn ) { sess -> srv_conn -> served -- ; if ( sess -> srv_conn -> proxy -> lbprm . server_drop_conn ) sess -> srv_conn -> proxy -> lbprm . server_drop_conn ( sess -> srv_conn ) ; session_del_srv_conn ( sess ) ; } if ( newsrv ) { newsrv -> served ++ ; if ( newsrv -> proxy -> lbprm . server_take_conn ) newsrv -> proxy -> lbprm . server_take_conn ( newsrv ) ; session_add_srv_conn ( sess , newsrv ) ; } }
This function adjusts sess->srv_conn and maintains the previous and new
 server's served session counts.
This function adjusts sess - > srv_conn and maintains the previous and new server ' s served session counts .