Merge lp:~chipaca/ubuntu-push/remove-handleconnstate into lp:ubuntu-push/automatic
- remove-handleconnstate
- Merge into automatic
Status: | Merged |
---|---|
Approved by: | John Lenton |
Approved revision: | 383 |
Merged at revision: | 377 |
Proposed branch: | lp:~chipaca/ubuntu-push/remove-handleconnstate |
Merge into: | lp:ubuntu-push/automatic |
Prerequisite: | lp:~chipaca/ubuntu-push/no-more-session-autoredial |
Diff against target: |
112 lines (+12/-21) 4 files modified
client/client.go (+1/-8) client/client_test.go (+8/-8) client/session/session.go (+2/-4) launch_helper/kindpool_test.go (+1/-1) |
To merge this branch: | bzr merge lp:~chipaca/ubuntu-push/remove-handleconnstate |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Samuele Pedroni | Approve | ||
Review via email: mp+253180@code.launchpad.net |
Commit message
Make client's loop call its session's HasConnectivity directly instead of through handleConnState.
Description of the change
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~chipaca/ubuntu-push/remove-handleconnstate into lp:ubuntu-push/automatic failed. Below is the output from the failed tests.
scripts/deps.sh ubuntu-
scripts/deps.sh server/
scripts/deps.sh server/
/mnt/tarmac/
rm -f -r /mnt/tarmac/
mkdir -p /mnt/tarmac/
mkdir -p /mnt/tarmac/
go get -u launchpad.
go get -d -u launchpad.
/mnt/tarmac/
g...
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~chipaca/ubuntu-push/remove-handleconnstate into lp:ubuntu-push/automatic failed. Below is the output from the failed tests.
scripts/deps.sh ubuntu-
scripts/deps.sh server/
scripts/deps.sh server/
/mnt/tarmac/
rm -f -r /mnt/tarmac/
mkdir -p /mnt/tarmac/
mkdir -p /mnt/tarmac/
go get -u launchpad.
go get -d -u launchpad.
/mnt/tarmac/
g...
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~chipaca/ubuntu-push/remove-handleconnstate into lp:ubuntu-push/automatic failed. Below is the output from the failed tests.
scripts/deps.sh ubuntu-
scripts/deps.sh server/
scripts/deps.sh server/
/mnt/tarmac/
rm -f -r /mnt/tarmac/
mkdir -p /mnt/tarmac/
mkdir -p /mnt/tarmac/
go get -u launchpad.
go get -d -u launchpad.
/mnt/tarmac/
g...
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~chipaca/ubuntu-push/remove-handleconnstate into lp:ubuntu-push/automatic failed. Below is the output from the failed tests.
scripts/deps.sh ubuntu-
scripts/deps.sh server/
scripts/deps.sh server/
/mnt/tarmac/
rm -f -r /mnt/tarmac/
mkdir -p /mnt/tarmac/
mkdir -p /mnt/tarmac/
go get -u launchpad.
go get -d -u launchpad.
/mnt/tarmac/
g...
- 383. By John Lenton
-
bump the timeout
Preview Diff
1 | === modified file 'client/client.go' |
2 | --- client/client.go 2015-03-10 12:32:36 +0000 |
3 | +++ client/client.go 2015-03-18 16:34:26 +0000 |
4 | @@ -382,13 +382,6 @@ |
5 | } |
6 | } |
7 | |
8 | -// handleConnState deals with connectivity events |
9 | -func (client *PushClient) handleConnState(hasConnectivity bool) { |
10 | - client.log.Debugf("handleConnState: %v", hasConnectivity) |
11 | - client.session.HasConnectivity(hasConnectivity) |
12 | - client.log.Debugf("handled.") |
13 | -} |
14 | - |
15 | // filterBroadcastNotification finds out if the notification is about an actual |
16 | // upgrade for the device. It expects msg.Decoded entries to look |
17 | // like: |
18 | @@ -500,7 +493,7 @@ |
19 | |
20 | // Loop calls doLoop with the "real" handlers |
21 | func (client *PushClient) Loop() { |
22 | - client.doLoop(client.handleConnState, |
23 | + client.doLoop(client.session.HasConnectivity, |
24 | client.handleBroadcastNotification, |
25 | client.handleUnicastNotification, |
26 | client.handleUnregister, |
27 | |
28 | === modified file 'client/client_test.go' |
29 | --- client/client_test.go 2015-03-10 12:32:36 +0000 |
30 | +++ client/client_test.go 2015-03-18 16:34:26 +0000 |
31 | @@ -532,7 +532,7 @@ |
32 | func (s *derivePollerSession) Close() {} |
33 | func (s *derivePollerSession) ClearCookie() {} |
34 | func (s *derivePollerSession) State() session.ClientSessionState { return session.Unknown } |
35 | -func (s *derivePollerSession) HasConnectivity(bool) error { return nil } |
36 | +func (s *derivePollerSession) HasConnectivity(bool) {} |
37 | func (s *derivePollerSession) KeepConnection() error { return nil } |
38 | func (s *derivePollerSession) StopKeepConnection() {} |
39 | |
40 | @@ -1068,9 +1068,9 @@ |
41 | return session.Disconnected |
42 | } |
43 | } |
44 | -func (s *loopSession) HasConnectivity(hasConn bool) error { s.hasConn = hasConn; return nil } |
45 | -func (s *loopSession) KeepConnection() error { return nil } |
46 | -func (s *loopSession) StopKeepConnection() {} |
47 | +func (s *loopSession) HasConnectivity(hasConn bool) { s.hasConn = hasConn } |
48 | +func (s *loopSession) KeepConnection() error { return nil } |
49 | +func (s *loopSession) StopKeepConnection() {} |
50 | |
51 | func (cs *clientSuite) TestLoop(c *C) { |
52 | cli := NewPushClient(cs.configPath, cs.leveldbPath) |
53 | @@ -1094,6 +1094,10 @@ |
54 | // at and the loop itself. |
55 | tick := func() { cli.sessionConnectedCh <- 42 } |
56 | |
57 | + c.Assert(cli.session, NotNil) |
58 | + cli.session.StopKeepConnection() |
59 | + cli.session = &loopSession{} |
60 | + |
61 | go cli.Loop() |
62 | |
63 | // sessionConnectedCh to nothing in particular, but it'll help sync this test |
64 | @@ -1101,10 +1105,6 @@ |
65 | tick() |
66 | c.Check(cs.log.Captured(), Matches, "(?msi).*Session connected after 42 attempts$") |
67 | |
68 | - c.Assert(cli.session, NotNil) |
69 | - cli.session.StopKeepConnection() |
70 | - cli.session = &loopSession{} |
71 | - |
72 | // loop() should have connected: |
73 | // * connCh to the connectivity checker |
74 | c.Check(cli.session.State(), Equals, session.Disconnected) |
75 | |
76 | === modified file 'client/session/session.go' |
77 | --- client/session/session.go 2015-03-17 16:46:55 +0000 |
78 | +++ client/session/session.go 2015-03-18 16:34:26 +0000 |
79 | @@ -131,7 +131,7 @@ |
80 | Close() |
81 | ClearCookie() |
82 | State() ClientSessionState |
83 | - HasConnectivity(bool) error |
84 | + HasConnectivity(bool) |
85 | KeepConnection() error |
86 | StopKeepConnection() |
87 | } |
88 | @@ -777,10 +777,8 @@ |
89 | close(sess.stopCh) |
90 | } |
91 | |
92 | -func (sess *clientSession) HasConnectivity(hasConn bool) error { |
93 | +func (sess *clientSession) HasConnectivity(hasConn bool) { |
94 | sess.connCh <- hasConn |
95 | - // XXX throw errors if called from weird state? |
96 | - return nil |
97 | } |
98 | |
99 | func init() { |
100 | |
101 | === modified file 'launch_helper/kindpool_test.go' |
102 | --- launch_helper/kindpool_test.go 2014-08-22 14:54:41 +0000 |
103 | +++ launch_helper/kindpool_test.go 2015-03-18 16:34:26 +0000 |
104 | @@ -45,7 +45,7 @@ |
105 | select { |
106 | case res := <-ch: |
107 | return res |
108 | - case <-time.After(100 * time.Millisecond): |
109 | + case <-time.After(time.Second): |
110 | c.Fatal("timeout waiting for result") |
111 | } |
112 | return nil |
I see, what I was wondering is passing in the channel connCh directly? anyway looks good