From 844f01b937eed4663a0a38751d1a9a27f923ef60 Mon Sep 17 00:00:00 2001 From: Jan Losinski Date: Sun, 25 Oct 2015 23:25:19 +0100 Subject: [PATCH] Simplify session match logic. The session match logic had two versions - one for the SESMAN_SESSION_TYPE_XRDP and SESMAN_SESSION_TYPE_XORG sessions and one for every other type. The only difference was, that different display sizes where ignored when searching for sessions to reconnect if the policy does not have the SESMAN_CFG_SESS_POLICY_D flag set and the type is SESMAN_SESSION_TYPE_XRDP or SESMAN_SESSION_TYPE_XORG. The reason was that xvnc cannot resize and the others can do. This two versions where not necessary because we set the SESMAN_CFG_SESS_POLICY_D flag every time we have a xvnc session a few lines above. So the two branches for the different types can be reduced to one. Signed-off-by: Jan Losinski --- sesman/session.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/sesman/session.c b/sesman/session.c index b2105ab0..643e3521 100644 --- a/sesman/session.c +++ b/sesman/session.c @@ -144,27 +144,9 @@ session_get_bydata(char *name, int width, int height, int bpp, int type, char *c tmp->item->client_ip); #endif - if ((type == SESMAN_SESSION_TYPE_XRDP) || (type == SESMAN_SESSION_TYPE_XORG)) - { - /* only name and bpp need to match for X11rdp, it can resize */ - if (g_strncmp(name, tmp->item->name, 255) == 0 && - (!(policy & SESMAN_CFG_SESS_POLICY_D) || - (tmp->item->width == width && tmp->item->height == height)) && - (!(policy & SESMAN_CFG_SESS_POLICY_I) || - (g_strncmp_d(client_ip, tmp->item->client_ip, ':', 255) == 0)) && - (!(policy & SESMAN_CFG_SESS_POLICY_C) || - (g_strncmp(client_ip, tmp->item->client_ip, 255) == 0)) && - tmp->item->bpp == bpp && - tmp->item->type == type) - { - /*THREAD-FIX release chain lock */ - lock_chain_release(); - return tmp->item; - } - } - if (g_strncmp(name, tmp->item->name, 255) == 0 && - (tmp->item->width == width && tmp->item->height == height) && + (!(policy & SESMAN_CFG_SESS_POLICY_D) || + (tmp->item->width == width && tmp->item->height == height)) && (!(policy & SESMAN_CFG_SESS_POLICY_I) || (g_strncmp_d(client_ip, tmp->item->client_ip, ':', 255) == 0)) && (!(policy & SESMAN_CFG_SESS_POLICY_C) ||