Bug 22817 - PendingChannelRequest should emit finished() as soon as ensureChannel() returns
Summary: PendingChannelRequest should emit finished() as soon as ensureChannel() returns
Status: RESOLVED INVALID
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-qt (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 22910
  Show dependency treegraph
 
Reported: 2009-07-17 06:42 UTC by George Goldberg
Modified: 2009-11-04 08:10 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description George Goldberg 2009-07-17 06:42:06 UTC
At the moment, PendingChannelRequest does not emit its finished signal until the ChannelRequest has finished. This becomes a problem in client applications such as Kopete.

When a user starts a chat with one of their remote contacts, we create a KopeteChatSession object that is internal to the client application. It then calls account->ensureChannel() to start a Telepathy channel. We also have a ClientHandler class in our application, which reimplements handleChannels().

In order to tell whether to pass the channels given to handleChannels() to an already existing KopeteChatSession when it is called, we must compare the requestsSatisfied with the ChannelRequest of each KopeteChatSession. However, the slot connected to PendingChannelRequest->finished() won't be called until after handleChannels() has returned, which means we can't get the ChannelRequest object in time.

Having PendingChannelRequest emit finished() before handleChannels() is called would fix this issue, while also making PendingChannelRequest's behaviour more consistent with the other Pending* objects in tpqt4. I understand that this would make things a bit more complicated (needing to handle the succeeded() and failed() signals of ChannelRequest), but I think this is a valid reason for the added complexity.

Some logs which may be useful:
MC debug output:
================
** (process:13398): DEBUG: _mcd_channel_set_status: 0xdae1c0, 1
** (process:13398): DEBUG: _mcd_dispatcher_add_request: Default handler KopetePluginHandler for request /com/nokia/MissionControl/requests/r14 doesn't want AddRequest
** (process:13398): DEBUG: _mcd_account_online_request: connection status for gabble/jabber/telepathy_2dtest2_40jabber_2eorg0 is 0
** (process:13398): DEBUG: _mcd_account_online_request: gabble/jabber/telepathy_2dtest2_40jabber_2eorg0 is already connected
** (process:13398): DEBUG: online_request_cb: called
** (process:13398): DEBUG: _mcd_mission_set_parent: child = 0xdae1c0, parent = 0xda3db0
** (process:13398): DEBUG: _mcd_channel_set_status: 0xdae1c0, 2
** (process:13398): DEBUG: common_request_channel_cb: 0xdae1c0, object /org/freedesktop/Telepathy/Connection/gabble/jabber/telepathy_2dtest2_40jabber_2eorg_2fTelepathy_2ed3bea447/ImChannel3
** (process:13398): DEBUG: _mcd_dispatcher_add_channel_request: reinvoking handler on channel 0xdc94a0
** (process:13398): DEBUG: _mcd_dispatcher_reinvoke_handler: CTXREF12 on 0xdbf320
** (process:13398): DEBUG: mcd_dispatcher_context_ref: CTXREF04 on 0xdbf320 (ref = 1)
** (process:13398): DEBUG: mcd_dispatcher_run_handlers: Possible handler: org.freedesktop.Telepathy.Client.KopetePluginHandler (still exists: Y)
** (process:13398): DEBUG: _mcd_channel_set_status: 0xdae1c0, 4
** (process:13398): DEBUG: mcd_dispatcher_context_ref: CTXREF03 on 0xdbf320 (ref = 2)
** (process:13398): DEBUG: mcd_dispatcher_handle_channels: calling HandleChannels on KopetePluginHandler for context 0xdbf320
** (process:13398): DEBUG: mcd_dispatcher_context_unref: CTXREF04 on 0xdbf320 (ref = 3)
** (process:13398): DEBUG: mcd_dispatcher_context_unref: CTXREF12 on 0xdbf320 (ref = 2)
** (process:13398): DEBUG: mcd_dispatcher_context_ref: CTXREF02 on 0xdbf320 (ref = 1)
** (process:13398): DEBUG: _mcd_channel_set_status: 0xdae1c0, 5
** (process:13398): DEBUG: mcd_channel_abort: 0xdae1c0
** (process:13398): DEBUG: _mcd_mission_set_parent: child = 0xdae1c0, parent = (nil)
** (process:13398): DEBUG: _mcd_operation_remove_mission: removing mission: 0xdae1c0
** (process:13398): DEBUG: mcd_dispatcher_context_unref: CTXREF02 on 0xdbf320 (ref = 2)
** (process:13398): DEBUG: mcd_handler_call_data_free: called
** (process:13398): DEBUG: mcd_dispatcher_context_unref: CTXREF03 on 0xdbf320 (ref = 1)
** (process:13398): DEBUG: mcd_dispatcher_context_unref: freeing the context 0xdbf320


TpQt4 debug output:
===================
kopete(31052)/kopete (Telepathy) TelepathyContact::manager:
kopete(31052)/kopete (Telepathy) TelepathyContact::manager:
kopete(31052)/kopete (Telepathy) TelepathyContact::manager:
kopete(31052)/kopete (Telepathy) TelepathyContact::isReachable: true
kopete(31052)/kopete (Telepathy) TelepathyContact::isReachable: true
kopete(31052)/kopete (Telepathy) TelepathyContact::manager:
kopete(31052)/kopete (Telepathy) TelepathyContact::manager:
kopete(31052)/kopete (Telepathy) TelepathyContact::manager:
kopete(31052)/kopete (Telepathy) TelepathyContact::manager: chat not exist
kopete(31052)/kopete (Telepathy) TelepathyChatSession::TelepathyChatSession:
kopete(31052)/kopete (Telepathy) TelepathyChatSession::createTextChannel:
kopete(31052)/kopete (Telepathy) TelepathyChatSession::createTextChannel: m_channelRequest: QObject(0x0)
telepathy-qt4 (version 0.1.7.1) DEBUG: Got reply to ChannelDispatcher.Ensure/CreateChannel - object path: "/com/nokia/MissionControl/requests/r15"
telepathy-qt4 (version 0.1.7.1) DEBUG: Creating new DBusProxy
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: supportedStatuses = QSet()
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: supportedFeatures = QSet()
telepathy-qt4 (version 0.1.7.1) DEBUG: Creating new ChannelRequest: "/com/nokia/MissionControl/requests/r15"
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: new supportedStatuses = QSet(0)
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: new supportedFeatures = QSet(QPair("Tp::ChannelRequest",0) )
telepathy-qt4 (version 0.1.7.1) DEBUG: HandleChannels: account: "/org/freedesktop/Telepathy/Account/gabble/jabber/telepathy_2dtest2_40jabber_2eorg0" , connection: "/org/freedesktop/Telepathy/Connection/gabble/jabber/telepathy_2dtest2_40jabber_2eorg_2fTelepathy_2e2d9023fe"
telepathy-qt4 (version 0.1.7.1) DEBUG: Creating new DBusProxy
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: supportedStatuses = QSet()
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: supportedFeatures = QSet()
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: new supportedStatuses = QSet(0)
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: new supportedFeatures = QSet(QPair("Tp::Account",0) ,  QPair("Tp::Account",1) ,  QPair("Tp::Account",2) )
telepathy-qt4 (version 0.1.7.1) DEBUG: Creating new DBusProxy
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: supportedStatuses = QSet()
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: supportedFeatures = QSet()
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: new supportedStatuses = QSet(0, 2)
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: new supportedFeatures = QSet(QPair("Tp::Connection",3) ,  QPair("Tp::Connection",2) ,  QPair("Tp::Connection",1) ,  QPair("Tp::Connection",0) )
telepathy-qt4 (version 0.1.7.1) DEBUG: Connecting to StatusChanged()
telepathy-qt4 (version 0.1.7.1) DEBUG: Calling GetStatus()
telepathy-qt4 (version 0.1.7.1) DEBUG: Reusing existing HandleContext
telepathy-qt4 (version 0.1.7.1) DEBUG: Creating new DBusProxy
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: supportedStatuses = QSet()
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: supportedFeatures = QSet()
telepathy-qt4 (version 0.1.7.1) DEBUG: Creating new Channel: ":1.652"
telepathy-qt4 (version 0.1.7.1) DEBUG:  Connecting to Channel::Closed() signal
telepathy-qt4 (version 0.1.7.1) DEBUG:  Connection to owning connection's lifetime signals
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: new supportedStatuses = QSet(0)
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: new supportedFeatures = QSet(QPair("Tp::Channel",0) )
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: new supportedStatuses = QSet(0)
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: new supportedFeatures = QSet(QPair("Tp::Channel",0) ,  QPair("Tp::TextChannel",0) ,  QPair("Tp::TextChannel",1) ,  QPair("Tp::TextChannel",2) )
telepathy-qt4 (version 0.1.7.1) DEBUG: Creating new DBusProxy
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: supportedStatuses = QSet()
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: supportedFeatures = QSet()
telepathy-qt4 (version 0.1.7.1) DEBUG: Creating new ChannelRequest: "/com/nokia/MissionControl/requests/r15"
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: new supportedStatuses = QSet(0)
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper: new supportedFeatures = QSet(QPair("Tp::ChannelRequest",0) )
kopete(31052) TelepathyChannelHandler::handleChannels: handling new channel
kopete(31052) TelepathyChannelHandler::handleChannels: Local initiated channel.
kopete(31052)/kopete (Telepathy) TelepathyChannelHandler::handleChannels: Channel Request Pointer: Tp::ChannelRequest(0x23f7910)
kopete(31052)/kopete (Telepathy) TelepathyChannelHandler::handleChannels: Telepathy Chat Session: TelepathyChatSession(0x1adb1c0)
kopete(31052)/kopete (Telepathy) TelepathyChatSession::channelRequest:
kopete(31052)/kopete (Telepathy) TelepathyChannelHandler::handleChannels: Session CRP: QObject(0x0)
kopete(31052)/kopete (Telepathy) TelepathyChatSession::channelRequest:
telepathy-qt4 (version 0.1.7.1) DEBUG: HandleChannels context finished successfully, updating handled channels
telepathy-qt4 (version 0.1.7.1) DEBUG: ignoring iterate introspection for status 4294967295
telepathy-qt4 (version 0.1.7.1) DEBUG: Calling Connection::becomeReady()
telepathy-qt4 (version 0.1.7.1) DEBUG: Got connection status 0
telepathy-qt4 (version 0.1.7.1) DEBUG: Calling GetInterfaces()
kopete(31052)/kopete (Telepathy) TelepathyChatSession::onEnsureChannelFinished:
telepathy-qt4 (version 0.1.7.1) DEBUG: Got reply to GetInterfaces(): ("org.freedesktop.Telepathy.Connection.Interface.Aliasing", "org.freedesktop.Telepathy.Connection.Interface.Capabilities", "org.freedesktop.Telepathy.Connection.Interface.SimplePresence", "org.freedesktop.Telepathy.Connection.Interface.Presence", "org.freedesktop.Telepathy.Connection.Interface.Avatars", "org.freedesktop.Telepathy.Connection.Interface.Contacts", "org.freedesktop.Telepathy.Connection.Interface.Requests", "org.laptop.Telepathy.Gadget", "org.freedesktop.Telepathy.Connection.Interface.ContactCapabilities.DRAFT", "org.freedesktop.Telepathy.Connection.Interface.Location.DRAFT")
telepathy-qt4 (version 0.1.7.1) DEBUG: Getting self handle
telepathy-qt4 (version 0.1.7.1) DEBUG: Got self handle 1
telepathy-qt4 (version 0.1.7.1) DEBUG: No interface found for "org.freedesktop.DBus.Properties"
telepathy-qt4 (version 0.1.7.1) DEBUG: Caching interface "org.freedesktop.DBus.Properties"
telepathy-qt4 (version 0.1.7.1) DEBUG: Getting available interfaces for GetContactAttributes
telepathy-qt4 (version 0.1.7.1) DEBUG: Got 6 contact attribute interfaces
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper::setIntrospectCompleted: feature: QPair("Tp::Connection",0) - success: true
telepathy-qt4 (version 0.1.7.1) DEBUG: No interface found for "org.freedesktop.DBus.Properties"
telepathy-qt4 (version 0.1.7.1) DEBUG: Caching interface "org.freedesktop.DBus.Properties"
telepathy-qt4 (version 0.1.7.1) DEBUG: Calling Properties::GetAll(Channel)
telepathy-qt4 (version 0.1.7.1) DEBUG: Got reply to Properties::GetAll(Channel)
telepathy-qt4 (version 0.1.7.1) DEBUG:  Found properties specified in 0.17.7
telepathy-qt4 (version 0.1.7.1) DEBUG: Faking a group on channel with self handle=1 and other handle=3
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper::isReady: critical feature QPair("Tp::Channel",0) not ready
telepathy-qt4 (version 0.1.7.1) DEBUG: Building contacts for 4 handles with 3 features
telepathy-qt4 (version 0.1.7.1) DEBUG:   0 satisfying and 2 other contacts
telepathy-qt4 (version 0.1.7.1) DEBUG:   3 features missing
telepathy-qt4 (version 0.1.7.1) DEBUG: 3 contact features supported using Tp::ContactManager(0x1b11630)
telepathy-qt4 (version 0.1.7.1) DEBUG: No interface found for "org.freedesktop.Telepathy.Connection.Interface.Aliasing"
telepathy-qt4 (version 0.1.7.1) DEBUG: Caching interface "org.freedesktop.Telepathy.Connection.Interface.Aliasing"
telepathy-qt4 (version 0.1.7.1) DEBUG: No interface found for "org.freedesktop.Telepathy.Connection.Interface.Avatars"
telepathy-qt4 (version 0.1.7.1) DEBUG: Caching interface "org.freedesktop.Telepathy.Connection.Interface.Avatars"
telepathy-qt4 (version 0.1.7.1) DEBUG: No interface found for "org.freedesktop.Telepathy.Connection.Interface.SimplePresence"
telepathy-qt4 (version 0.1.7.1) DEBUG: Caching interface "org.freedesktop.Telepathy.Connection.Interface.SimplePresence"
telepathy-qt4 (version 0.1.7.1) DEBUG:  Fetching 3 interfaces for 2 contacts
telepathy-qt4 (version 0.1.7.1) DEBUG:  Building contacts using contact attributes
telepathy-qt4 (version 0.1.7.1) DEBUG: Request for attributes for 2 contacts
telepathy-qt4 (version 0.1.7.1) DEBUG: PendingContactAttributes()
telepathy-qt4 (version 0.1.7.1) DEBUG: No interface found for "org.freedesktop.Telepathy.Connection.Interface.Contacts"
telepathy-qt4 (version 0.1.7.1) DEBUG: Caching interface "org.freedesktop.Telepathy.Connection.Interface.Contacts"
telepathy-qt4 (version 0.1.7.1) DEBUG: Channel has 3 optional interfaces: ("org.freedesktop.Telepathy.Channel.Interface.ChatState", "org.freedesktop.Telepathy.Channel.Interface.Messages", "org.freedesktop.Telepathy.Channel.Interface.Destroyable")
telepathy-qt4 (version 0.1.7.1) DEBUG: Have initiator handle: yes
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper::isReady: critical feature QPair("Tp::Channel",0) not ready
telepathy-qt4 (version 0.1.7.1) DEBUG: Introspection done before contacts done - contacts sets ready
telepathy-qt4 (version 0.1.7.1) DEBUG: Received reply to GetContactAttributes
telepathy-qt4 (version 0.1.7.1) DEBUG:  Success: 2 valid and 0 invalid handles
telepathy-qt4 (version 0.1.7.1) DEBUG: Attributes finished for Tp::PendingContacts(0x1e2a800)
telepathy-qt4 (version 0.1.7.1) DEBUG:  Success: 2 valid and 0 invalid handles
telepathy-qt4 (version 0.1.7.1) DEBUG: Entering Chan::Priv::updateContacts() with 4 contacts
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper::isReady: critical feature QPair("Tp::Channel",0) not ready
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper::isReady: critical feature QPair("Tp::Channel",0) not ready
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper::isReady: critical feature QPair("Tp::Channel",0) not ready
telepathy-qt4 (version 0.1.7.1) DEBUG: Both the MCD and the introspect queue empty for the first time. Ready!
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper::isReady: critical feature QPair("Tp::Channel",0) not ready
telepathy-qt4 (version 0.1.7.1) DEBUG: Channel fully ready
telepathy-qt4 (version 0.1.7.1) DEBUG:  Channel type "org.freedesktop.Telepathy.Channel.Type.Text"
telepathy-qt4 (version 0.1.7.1) DEBUG:  Target handle 3
telepathy-qt4 (version 0.1.7.1) DEBUG:  Target handle type 1
telepathy-qt4 (version 0.1.7.1) DEBUG: ReadinessHelper::setIntrospectCompleted: feature: QPair("Tp::Channel",0) - success: true
Comment 1 George Goldberg 2009-07-17 07:02:32 UTC
I have hacked around this bug for now by storing the PendingChannelRequest as a member of the KopeteChatSession object and then when handleChannels() is called, accessing the PendingChannelRequest and getting the ChannelRequest directly from it. This works, but does not seem like the correct solution.
Comment 2 Simon McVittie 2009-10-09 08:38:11 UTC
Please consider this before 0.2.
Comment 3 Simon McVittie 2009-11-04 08:10:14 UTC
George and Andre agreed that this was invalid, apparently. No longer a 0.2 blocker.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.