Hi Tomasz, On Fri, Jul 01, 2011 at 10:49:35AM +0300, Tomasz Bursztyka wrote: > In previous patch, __connman_service_ipconfig_indicate_state() was introduced. > Now the ipconfig state logic which was in __connman_service_indicate_state() > has been moved there. good.
> If relevant, __connman_service_indicate_state() will be called from > __connman_service_ipconfig_indicate_state(). > Now, a service owns a state variable, to avoid calling multiple time > combine_state() That actually makes sense, regardless of this patch scope. So could you please generate a separate patch for that. It will also make the core of the below patch clearer. Some additional comments: > @@ -3706,44 +3623,86 @@ int __connman_service_ipconfig_indicate_state(struct > connman_service *service, > enum connman_service_state state, > enum connman_ipconfig_type type) > { > - enum connman_service_state current_state; > - int err = 0; > + struct connman_ipconfig *ipconfig = NULL; > + enum connman_service_state old_state, new_state; > + enum connman_service_proxy_method proxy_config; > + > + if (service == NULL) > + return -EINVAL; > + > + if (type == CONNMAN_IPCONFIG_TYPE_IPV4) { > + old_state = service->state_ipv4; > + ipconfig = service->ipconfig_ipv4; > + } else if (type == CONNMAN_IPCONFIG_TYPE_IPV6) { > + old_state = service->state_ipv6; > + ipconfig = service->ipconfig_ipv6; > + } > + > + if (ipconfig == NULL) > + return -EINVAL; > + > + new_state = combine_state(state, old_state); As discussed on IRC: We probably don't need that, and moreover this seems wrong. combine_state is not designed for that but rather for combining v4 and v6 states. > + /* Any change? */ > + if (old_state == new_state) > + return -EALREADY; > + That should be enough for preventing the "the same state can be sent several times" case. Cheers, Samuel. -- Intel Open Source Technology Centre http://oss.intel.com/ _______________________________________________ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman