Hi,

Between versions 1.22 and 1.23 commit a7fb517201cfc0ec7914ad2a4dc653889e508c9e 
changed the DBus reply behaviour of the service connect method. Prior to this 
commit the DBus method call would not complete until after the connection was 
established or failed. After this commit the DBus call is always (as far as I 
can tell) completed immediately.

For reference the relevant code from connect_service() is copied below.

For the case where err is -EINPROGRESS, the original version would not send a 
DBus reply (returning NULL) leaving service->pending valid. The DBus reply is 
sent at a later time. In the new version the if block is now skipped and the 
generic DBus reply sent.

Was this behaviour change intended? It changes how applications are expected 
to interact with Connman. A consequence of the new version is that when err is 
-EINPROGRESS a DBus reply is sent immediately but service->pending may still 
be valid causing a second DBus reply to be sent later. The second reply will 
be rejected by the DBus daemon and never received by the remote process.

======== Original code ==========================
err = __connman_service_connect(service,
            CONNMAN_SERVICE_CONNECT_REASON_USER);
if (err < 0) {
    if (!service->pending)
        return NULL;

    if (err != -EINPROGRESS) {
        dbus_message_unref(service->pending);
        service->pending = NULL;

        return __connman_error_failed(msg, -err);
    }

    return NULL;
}

return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
====================================================


========= New code =================================
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;

        return __connman_error_failed(msg, -err);
    }

    return NULL;
}

return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
===================================================

Cheers,

-- 
Aaron McCarthy
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to