From: Patrik Flykt Date: Thu, 2 Dec 2010 14:09:13 +0000 (+0200) Subject: service: Create service_complete helper function X-Git-Tag: 2.0_alpha~2058 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=51c70b7e59392fd5fa86c46dbec5dd9d847c7fc2;p=framework%2Fconnectivity%2Fconnman.git service: Create service_complete helper function The service_complete helper function factors out reply sending to clients, running autoconnect and updating service modification time. --- diff --git a/src/service.c b/src/service.c index b1842d6..1c29d88 100644 --- a/src/service.c +++ b/src/service.c @@ -2931,6 +2931,17 @@ void __connman_service_set_string(struct connman_service *service, } } +static void service_complete(struct connman_service *service) +{ + reply_pending(service, EIO); + + if (service->userconnect == FALSE) + __connman_service_auto_connect(); + + g_get_current_time(&service->modified); + __connman_storage_save_service(service); +} + int __connman_service_indicate_state(struct connman_service *service, enum connman_service_state state) { @@ -3027,13 +3038,7 @@ int __connman_service_indicate_state(struct connman_service *service, } if (state == CONNMAN_SERVICE_STATE_FAILURE) { - reply_pending(service, EIO); - - if (service->userconnect == FALSE) - __connman_service_auto_connect(); - - g_get_current_time(&service->modified); - __connman_storage_save_service(service); + service_complete(service); } else service->error = CONNMAN_SERVICE_ERROR_UNKNOWN;