From: Adam Dickmeiss Date: Tue, 23 Feb 2010 11:21:13 +0000 (+0100) Subject: Optimize client_set_state for active state X-Git-Tag: v1.4.0~116 X-Git-Url: http://git.indexdata.com/?a=commitdiff_plain;h=d84f89a5d8d75ea311c12a1ef89b7eea28c560fb;p=pazpar2-moved-to-github.git Optimize client_set_state for active state Function client_set_state no longer calls session_active_clients to check whether active clients has reached zero - when the state that is being set for the client parameter is already known to be "active". --- diff --git a/src/client.c b/src/client.c index 4c6c780..016d874 100644 --- a/src/client.c +++ b/src/client.c @@ -117,7 +117,9 @@ enum client_state client_get_state(struct client *cl) void client_set_state(struct client *cl, enum client_state st) { cl->state = st; - if (cl->session) + /* no need to check for all client being non-active if this one + already is. Note that session_active_clients also LOCKS session */ + if (!client_is_active(cl) && cl->session) { int no_active = session_active_clients(cl->session); if (no_active == 0)