From 269cadfb020711762a2580ed92b242b5b3150677 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 24 Aug 2011 17:02:01 +0300 Subject: [PATCH] service: Fix state combining If we have IPv6 state as DISCONNECT and IPv4 state as ONLINE or READY then we are not disconnected. --- src/service.c | 64 +++++++++++++++-------------------------------------------- 1 file changed, 16 insertions(+), 48 deletions(-) diff --git a/src/service.c b/src/service.c index 62ad20a..de6541d 100644 --- a/src/service.c +++ b/src/service.c @@ -743,75 +743,43 @@ static enum connman_service_state combine_state( goto done; } - if (state_a == CONNMAN_SERVICE_STATE_ASSOCIATION) { - if (state_b == CONNMAN_SERVICE_STATE_CONFIGURATION || - state_b == CONNMAN_SERVICE_STATE_ONLINE || - state_b == CONNMAN_SERVICE_STATE_READY) - result = state_b; - else - result = state_a; + if (state_a == CONNMAN_SERVICE_STATE_ONLINE) { + result = state_a; goto done; } - if (state_b == CONNMAN_SERVICE_STATE_ASSOCIATION) { - if (state_a == CONNMAN_SERVICE_STATE_CONFIGURATION || - state_a == CONNMAN_SERVICE_STATE_ONLINE || - state_a == CONNMAN_SERVICE_STATE_READY) - result = state_a; - else - result = state_b; + if (state_b == CONNMAN_SERVICE_STATE_ONLINE) { + result = state_b; goto done; } - if (state_a == CONNMAN_SERVICE_STATE_CONFIGURATION) { - if (state_b == CONNMAN_SERVICE_STATE_ONLINE || - state_b == CONNMAN_SERVICE_STATE_READY) - result = state_b; - else - result = state_a; + if (state_a == CONNMAN_SERVICE_STATE_READY) { + result = state_a; goto done; } - if (state_b == CONNMAN_SERVICE_STATE_CONFIGURATION) { - if (state_a == CONNMAN_SERVICE_STATE_ONLINE || - state_a == CONNMAN_SERVICE_STATE_READY) - result = state_a; - else - result = state_b; + if (state_b == CONNMAN_SERVICE_STATE_READY) { + result = state_b; goto done; } - if (state_a == CONNMAN_SERVICE_STATE_READY) { - if (state_b == CONNMAN_SERVICE_STATE_ONLINE || - state_b == CONNMAN_SERVICE_STATE_DISCONNECT) - result = state_b; - else - result = state_a; + if (state_a == CONNMAN_SERVICE_STATE_CONFIGURATION) { + result = state_a; goto done; } - if (state_b == CONNMAN_SERVICE_STATE_READY) { - if (state_a == CONNMAN_SERVICE_STATE_ONLINE || - state_a == CONNMAN_SERVICE_STATE_DISCONNECT) - result = state_a; - else - result = state_b; + if (state_b == CONNMAN_SERVICE_STATE_CONFIGURATION) { + result = state_b; goto done; } - if (state_a == CONNMAN_SERVICE_STATE_ONLINE) { - if (state_b == CONNMAN_SERVICE_STATE_DISCONNECT) - result = state_b; - else - result = state_a; + if (state_a == CONNMAN_SERVICE_STATE_ASSOCIATION) { + result = state_a; goto done; } - if (state_b == CONNMAN_SERVICE_STATE_ONLINE) { - if (state_a == CONNMAN_SERVICE_STATE_DISCONNECT) - result = state_a; - else - result = state_b; + if (state_b == CONNMAN_SERVICE_STATE_ASSOCIATION) { + result = state_b; goto done; } -- 2.7.4