Merge lp:~verterok/ubuntu-push/fix-1378908 into lp:ubuntu-push

Proposed by Guillermo Gonzalez
Status: Merged
Approved by: John Lenton
Approved revision: 133
Merged at revision: 134
Proposed branch: lp:~verterok/ubuntu-push/fix-1378908
Merge into: lp:ubuntu-push
Diff against target: 50 lines (+21/-0)
3 files modified
client/client.go (+1/-0)
client/session/session.go (+6/-0)
client/session/session_test.go (+14/-0)
To merge this branch: bzr merge lp:~verterok/ubuntu-push/fix-1378908
Reviewer Review Type Date Requested Status
John Lenton (community) Approve
Review via email: mp+239456@code.launchpad.net

Commit message

Add ClearCookie method to the session and call it from handleAccountsChange.

Description of the change

Add ClearCookie method to the session and call it from handleAccountsChange.

To post a comment you must log in.
Revision history for this message
John Lenton (chipaca) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'client/client.go'
2--- client/client.go 2014-09-05 10:47:29 +0000
3+++ client/client.go 2014-10-23 19:33:15 +0000
4@@ -471,6 +471,7 @@
5 // changing) the u1 account used to auth
6 func (client *PushClient) handleAccountsChange() {
7 client.log.Infof("U1 account changed; restarting session")
8+ client.session.ClearCookie()
9 client.session.Close()
10 }
11
12
13=== modified file 'client/session/session.go'
14--- client/session/session.go 2014-08-26 16:05:28 +0000
15+++ client/session/session.go 2014-10-23 19:33:15 +0000
16@@ -247,6 +247,12 @@
17 return sess.cookie
18 }
19
20+func (sess *ClientSession) ClearCookie() {
21+ sess.connLock.Lock()
22+ defer sess.connLock.Unlock()
23+ sess.cookie = ""
24+}
25+
26 // getHosts sets deliveryHosts possibly querying a remote endpoint
27 func (sess *ClientSession) getHosts() error {
28 if sess.getHost != nil {
29
30=== modified file 'client/session/session_test.go'
31--- client/session/session_test.go 2014-09-01 16:03:06 +0000
32+++ client/session/session_test.go 2014-10-23 19:33:15 +0000
33@@ -1687,3 +1687,17 @@
34 // and redialJitter got called every time shouldDelay was true
35 c.Check(n, Equals, 4)
36 }
37+
38+/****************************************************************
39+ ClearCookie() tests
40+****************************************************************/
41+
42+func (cs *clientSessionSuite) TestClearCookie(c *C) {
43+ sess, err := NewSession("foo:443", dummyConf, "", cs.lvls, cs.log)
44+ c.Assert(err, IsNil)
45+ c.Check(sess.getCookie(), Equals, "")
46+ sess.setCookie("COOKIE")
47+ c.Check(sess.getCookie(), Equals, "COOKIE")
48+ sess.ClearCookie()
49+ c.Check(sess.getCookie(), Equals, "")
50+}

Subscribers

People subscribed via source and target branches