Bug 56044 - tp_base_call_channel_hangup: Only set_state to ENDED if not set
Summary: tp_base_call_channel_hangup: Only set_state to ENDED if not set
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-glib (show other bugs)
Version: git master
Hardware: Other All
: medium normal
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-16 18:28 UTC by Debarshi Ray
Modified: 2012-10-17 15:01 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
DBus log (2.33 KB, text/plain)
2012-10-16 18:28 UTC, Debarshi Ray
Details
base-call-channel: Set state to ENDED in hangup only if not set (1.37 KB, patch)
2012-10-16 18:36 UTC, Debarshi Ray
Details | Splinter Review
base-call-channel: Ignore spurious transitions (972 bytes, patch)
2012-10-17 09:28 UTC, Debarshi Ray
Details | Splinter Review
base-call-channel: Ignore transitions with same flags and state (1.56 KB, patch)
2012-10-17 12:12 UTC, Debarshi Ray
Details | Splinter Review
base-call-channel: Ignore transitions with the same state (903 bytes, patch)
2012-10-17 12:57 UTC, Debarshi Ray
Details | Splinter Review
base-call-channel: Don't call set_state from set_ringing and set_queued (2.43 KB, patch)
2012-10-17 12:58 UTC, Debarshi Ray
Details | Splinter Review
base-call-channel: Ignore transitions with the same state (1.76 KB, patch)
2012-10-17 13:53 UTC, Debarshi Ray
Details | Splinter Review

Description Debarshi Ray 2012-10-16 18:28:05 UTC
Created attachment 68639 [details]
DBus log

Gabble's implementation of the hangup virtual method sets the state to TP_CALL_STATE_ENDED. See call_session_terminated_cb in telepathy-gabble.

This causes an extra CallStateChanged signal to be emitted on the bus. See attached log.
Comment 1 Debarshi Ray 2012-10-16 18:36:26 UTC
Created attachment 68640 [details] [review]
base-call-channel: Set state to ENDED in hangup only if not set

Against telepathy-glib-0.20 branch.

(I am wondering why tp_base_call_channel_set_state does not check and ignore transitions where the current and destination states are the same.)
Comment 2 Debarshi Ray 2012-10-17 09:28:36 UTC
Created attachment 68678 [details] [review]
base-call-channel: Ignore spurious transitions

Against telepathy-glib-0.20 branch.

Lets make tp_base_call_channel_set_state check and ignore this, as hinted earlier.

--

However, this causes the following failure in tp-gabble's test suite:
Traceback (most recent call last):
  File "/home/rishi/devel/telepathy/git/telepathy-gabble/tests/twisted/gabbletest.py", line 634, in exec_test_deferred
    fun(queue, bus, conns[0], streams[0])
  File "/home/rishi/devel/telepathy/git/telepathy-gabble/tests/twisted/jingle/call_helper.py", line 809, in run_call_test
    test.run()
  File "/home/rishi/devel/telepathy/git/telepathy-gabble/tests/twisted/jingle/call_helper.py", line 802, in run
    self.pickup()
  File "./jingle/call-basics.py", line 116, in pickup
    CallTest.pickup(self)
  File "/home/rishi/devel/telepathy/git/telepathy-gabble/tests/twisted/jingle/call_helper.py", line 644, in pickup
    signal = self.q.expect('dbus-signal', signal='CallStateChanged')
  File "/home/rishi/devel/telepathy/git/telepathy-gabble/tests/twisted/servicetest.py", line 173, in expect
    event = self.wait([pattern.subqueue])
  File "/home/rishi/devel/telepathy/git/telepathy-gabble/tests/twisted/servicetest.py", line 307, in wait
    raise TimeoutError
TimeoutError
FAIL: jingle/call-basics.py
Comment 3 Xavier Claessens 2012-10-17 10:03:49 UTC
In tp_base_call_channel_set_state() the 2 if conditions at the end actually check if self->priv->state != old_state, which indicate there were a reason for not early return.

It's probably me who wrote that, but I rekon I don't remember the reason. A failing unit test seems to also indicate that there is a reason for not early returning. Olivier may know, I'll ask him.
Comment 4 Xavier Claessens 2012-10-17 10:11:08 UTC
Ok, reading the unit test, I actually see the reason (good think this is all well tested). So in tp_base_call_channel_set_ringing() we call tp_base_call_channel_set_state() not to change the state, but to add the RINGING flag. This actually makes sense, the state of the call did not actually change, but the UI is reporting that it is now playing ringing sound.
Comment 5 Debarshi Ray 2012-10-17 12:12:43 UTC
Created attachment 68689 [details] [review]
base-call-channel: Ignore transitions with same flags and state

Compare the flags too and special case TP_CALL_FLAG_LOCALLY_RINGING.
Comment 6 Debarshi Ray 2012-10-17 12:57:48 UTC
Created attachment 68700 [details] [review]
base-call-channel: Ignore transitions with the same state
Comment 7 Debarshi Ray 2012-10-17 12:58:21 UTC
Created attachment 68701 [details] [review]
base-call-channel: Don't call set_state from set_ringing and set_queued
Comment 8 Debarshi Ray 2012-10-17 13:53:17 UTC
Created attachment 68707 [details] [review]
base-call-channel: Ignore transitions with the same state
Comment 9 Xavier Claessens 2012-10-17 14:01:32 UTC
Looks good, ship it :)

Thanks.
Comment 10 Debarshi Ray 2012-10-17 15:01:56 UTC
Pushed to both master and telepathy-glib-0.20 branches.

commit 48a6895f21fd3a3ef996e3e18ded4ed8a8f9f576
Author: Debarshi Ray <rishi@gnu.org>
Date:   Wed Oct 17 14:48:11 2012 +0200

    base-call-channel: Don't call set_state from set_ringing and set_queued
    
    ... because they only change the flags and not the state. Instead emit
    CallStateChanged directly.
    
    Fixes: https://bugs.freedesktop.org/56044

commit dfca38a93e2c504c1a4643eec291c4ddb4368f4f
Author: Debarshi Ray <rishi@gnu.org>
Date:   Wed Oct 17 10:50:24 2012 +0200

    base-call-channel: Ignore transitions with the same state
    
    Fixes: https://bugs.freedesktop.org/56044


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.