When the service is instantly connected or an error occured, remove the pending call and report success or failure immediately to the caller. When the connect procedure indicates -EINPROGRESS, the caller will be informed later and no D-Bus reply is to be sent from this function.
The service pending call needs to be set when calling __connman_service_connect() as later stages in the code will decide whether to ask an Agent for input based on its non-NULL value. Reported by Aaron McCarthy <[email protected]> --- src/service.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/service.c b/src/service.c index a40ac3e..b3a46d1 100644 --- a/src/service.c +++ b/src/service.c @@ -3971,16 +3971,14 @@ static DBusMessage *connect_service(DBusConnection *conn, err = __connman_service_connect(service, CONNMAN_SERVICE_CONNECT_REASON_USER); - if (err < 0 && err != -EINPROGRESS) { - if (service->pending) { - dbus_message_unref(service->pending); - service->pending = NULL; + if (err == -EINPROGRESS) + return NULL; - return __connman_error_failed(msg, -err); - } + dbus_message_unref(service->pending); + service->pending = NULL; - return NULL; - } + if (err < 0) + return __connman_error_failed(msg, -err); return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); } -- 1.9.1 _______________________________________________ connman mailing list [email protected] https://lists.connman.net/mailman/listinfo/connman
