From 63f32f20d6f339bae00a21c655c8958ce9999579 Mon Sep 17 00:00:00 2001 From: Patrik Flykt Date: Tue, 9 Aug 2011 10:59:17 +0300 Subject: [PATCH] service: Fix calling Agent API request input function Requesting passphrases from the user has been done only when the ConnectService D-Bus method has been called. As user input may be needed every time a service is connected, input requesting moved to __connman_service_connect() instead. Also to note is that the same service can be retried after a failed connection attempt, for those cases an already associated service->network needs to be disconnected before an new connection is attempted. --- src/service.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/service.c b/src/service.c index 7c0bf4d..154ddfa 100644 --- a/src/service.c +++ b/src/service.c @@ -2813,13 +2813,6 @@ static DBusMessage *connect_service(DBusConnection *conn, err = __connman_service_connect(service); if (err < 0) { - if (err == -ENOKEY) { - if (__connman_agent_request_input(service, - request_input_cb, - NULL) == 0) - return NULL; - } - if (service->pending == NULL) return NULL; @@ -3996,12 +3989,6 @@ int __connman_service_connect(struct connman_service *service) return -EINPROGRESS; } - if (err == -ENOKEY) - return -ENOKEY; - - if (service->userconnect == TRUE) - reply_pending(service, err); - __connman_service_ipconfig_indicate_state(service, CONNMAN_SERVICE_STATE_FAILURE, CONNMAN_IPCONFIG_TYPE_IPV4); @@ -4009,6 +3996,18 @@ int __connman_service_connect(struct connman_service *service) CONNMAN_SERVICE_STATE_FAILURE, CONNMAN_IPCONFIG_TYPE_IPV6); + __connman_network_disconnect(service->network); + + if (service->userconnect == TRUE) { + if (err == -ENOKEY) { + if (__connman_agent_request_input(service, + request_input_cb, + NULL) == -EIO) + return -EINPROGRESS; + } + reply_pending(service, err); + } + return err; } -- 2.7.4