Bug 26583 - Allow channels to be dispatched before a connection is established
Summary: Allow channels to be dispatched before a connection is established
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: mission-control (show other bugs)
Version: git master
Hardware: Other All
: medium normal
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL: http://git.collabora.co.uk/?p=user/ei...
Whiteboard: review+
Keywords: patch
Depends on:
Blocks:
 
Reported: 2010-02-15 14:21 UTC by Eitan Isaacson
Modified: 2010-04-06 11:45 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Move _mcd_dispatcher_add_connection to an earlier stage. (1.64 KB, patch)
2010-02-17 12:27 UTC, Eitan Isaacson
Details | Splinter Review
Move _mcd_dispatcher_add_connection to an earlier stage. (1.53 KB, patch)
2010-02-17 13:54 UTC, Eitan Isaacson
Details | Splinter Review

Description Eitan Isaacson 2010-02-15 14:21:05 UTC
Currently the channel dispatcher is only set up after the Connection has been connected. There is a need for channels to be dispatched before this, specifically when a verification channel is received when a SSL certificate needs to be verified.
Comment 1 Eitan Isaacson 2010-02-17 12:27:41 UTC
Created attachment 33366 [details] [review]
Move _mcd_dispatcher_add_connection to an earlier stage.
Comment 2 Eitan Isaacson 2010-02-17 13:54:09 UTC
Created attachment 33369 [details] [review]
Move _mcd_dispatcher_add_connection to an earlier stage.
Comment 3 Simon McVittie 2010-02-18 03:46:40 UTC
Where's the git branch? Referencing gitweb is generally easier than attaching a series of diffs.

This functionality needs a regression test.

Please add the 'patch' keyword when this is ready for review.
Comment 4 Eitan Isaacson 2010-02-18 17:51:46 UTC
Since it was such a small change, I thought it would be easier to review as a patch. Here is the git branch:

http://git.collabora.co.uk/?p=user/eitan/telepathy-mission-control.git;a=summary

I just looked at the regression tests, and it's less than trivial, so once I learn how to write new tests, I'll do that and tag this report as 'patch'.
Comment 5 Eitan Isaacson 2010-02-25 15:00:55 UTC
Added a regression test, adjusted current tests, and made amendments where tests were sincerely failing.
Comment 6 Simon McVittie 2010-02-26 04:43:47 UTC
I'll have a look, thanks.

(Telepathy convention is usually to put the thing to be reviewed in the URL field of the bug, btw.)
Comment 7 Simon McVittie 2010-02-26 05:09:09 UTC
+    if (!priv->dispatching_started)
     _mcd_dispatcher_add_connection (priv->dispatcher, connection);

Indentation, please.

+    e = q.expect('dbus-signal', signal='StatusChanged')
+
+    # Connection should be in "Connecting" status for this test.
+    assert e.args == [cs.CONN_STATUS_CONNECTING, cs.CONN_STATUS_REASON_REQUESTED]

This seems suspicious: this signal was emitted by the SimulatedConnection, which is part of your test code, so you shouldn't have to expect() it. You can expect() a call to Connect() instead?

The code changes look good, though.
Comment 8 Eitan Isaacson 2010-02-26 08:42:03 UTC
(In reply to comment #7)
> +    if (!priv->dispatching_started)
>      _mcd_dispatcher_add_connection (priv->dispatcher, connection);
> 
> Indentation, please.

That file is very confusing. Right above that statement is a similar one with a tab indentation. Anyway, I fixed it to what I believe it should be in that file.

> 
> +    e = q.expect('dbus-signal', signal='StatusChanged')
> +
> +    # Connection should be in "Connecting" status for this test.
> +    assert e.args == [cs.CONN_STATUS_CONNECTING,
> cs.CONN_STATUS_REASON_REQUESTED]
> 
> This seems suspicious: this signal was emitted by the SimulatedConnection,
> which is part of your test code, so you shouldn't have to expect() it. You can
> expect() a call to Connect() instead?

Yeah, that's stupid. Fixed.

> 
> The code changes look good, though.
> 

Comment 9 Simon McVittie 2010-03-15 07:47:19 UTC
You still seem to be expect()ing StatusChanged. Why? The test script has full control over the SimulatedConnection's status, so this makes no sense.

Tests should be making expectations/assertions about what the code under test (MC) does, not about what the test harness does. The SimulatedConnection, and all other Python code in test/twisted/, is part of the test harness.

As I said previously, one event that it *would* make sense to expect() is the call to Connect(), which MC will do. This happens to cause StatusChanged as a side-effect of the SimulatedConnection's implementation of Connect.
Comment 10 Eitan Isaacson 2010-03-17 10:44:11 UTC
(In reply to comment #9)
> You still seem to be expect()ing StatusChanged. Why? The test script has full
> control over the SimulatedConnection's status, so this makes no sense.
> 

I left it there purely for readability reasons, the channel is dispatched when the connection is in Connecting status.

> As I said previously, one event that it *would* make sense to expect() is the
> call to Connect(), which MC will do. This happens to cause StatusChanged as a
> side-effect of the SimulatedConnection's implementation of Connect.
> 

I'll use that instead, should answer my goal above.
Comment 11 Simon McVittie 2010-04-06 11:45:13 UTC
This appears to be fixed in master.


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.