[PATCH 07/12] session: filtering session state update according to connection type

Daniel Wagner wagi at monom.org
Thu Feb 9 07:20:21 PST 2012


Hi Tomasz,

On 08.02.2012 15:13, Tomasz Bursztyka wrote:
> ---
>  src/session.c |   49 ++++++++++++++++++++++++++++++++++++++++++++++---
>  1 files changed, 46 insertions(+), 3 deletions(-)
> 
> diff --git a/src/session.c b/src/session.c
> index 57a911a..f820aec 100644
> --- a/src/session.c
> +++ b/src/session.c
> @@ -545,6 +545,30 @@ static void append_notify(DBusMessageIter *dict,
>  	session->append_all = FALSE;
>  }
>  
> +static connman_bool_t is_type_matching_state(enum connman_session_state *state,
> +						enum connman_session_type type)
> +{
> +	switch (type) {
> +	case CONNMAN_SESSION_TYPE_ANY:
> +		return TRUE;
> +	case CONNMAN_SESSION_TYPE_LOCAL:
> +		if (*state >= CONNMAN_SESSION_STATE_CONNECTED) {
> +			*state = CONNMAN_SESSION_STATE_CONNECTED;
> +			return TRUE;
> +		}
> +
> +		break;
> +	case CONNMAN_SESSION_TYPE_INTERNET:
> +		if (*state == CONNMAN_SESSION_STATE_ONLINE)
> +			return TRUE;
> +		break;
> +	default:
> +		break;
> +	}

IIRC, we avoid the default statement if possible.

cheers,
daniel



More information about the connman mailing list