Merge lp:~pedronis/ubuntu-push/freelance-exchanges into lp:ubuntu-push

Proposed by Samuele Pedroni
Status: Merged
Approved by: Samuele Pedroni
Approved revision: 21
Merged at revision: 20
Proposed branch: lp:~pedronis/ubuntu-push/freelance-exchanges
Merge into: lp:ubuntu-push
Prerequisite: lp:~pedronis/ubuntu-push/server-bits-in-server
Diff against target: 526 lines (+244/-161)
6 files modified
server/broker/broker.go (+7/-0)
server/broker/exchanges.go (+74/-0)
server/broker/exchanges_test.go (+123/-0)
server/broker/simple.go (+18/-52)
server/broker/simple_test.go (+14/-109)
server/session/session_test.go (+8/-0)
To merge this branch: bzr merge lp:~pedronis/ubuntu-push/freelance-exchanges
Reviewer Review Type Date Requested Status
John Lenton (community) Approve
Review via email: mp+203000@code.launchpad.net

Commit message

exchanges don't require to be so tied to a particular broker

Description of the change

with a bit of reorg exchanges don't require to be so tied to a particular broker

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

Only issues I'd have with this one are fixed in the next one. Good job.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'server/broker/broker.go'
--- server/broker/broker.go 2014-01-14 15:35:20 +0000
+++ server/broker/broker.go 2014-01-24 07:56:28 +0000
@@ -44,6 +44,9 @@
44 Acked(BrokerSession) error44 Acked(BrokerSession) error
45}45}
4646
47// LevelsMap is the type for holding levels for session.
48type LevelsMap map[store.InternalChannelId]int64
49
47// BrokerSession holds broker session state.50// BrokerSession holds broker session state.
48type BrokerSession interface {51type BrokerSession interface {
49 // SessionChannel returns the session control channel52 // SessionChannel returns the session control channel
@@ -51,6 +54,10 @@
51 SessionChannel() <-chan Exchange54 SessionChannel() <-chan Exchange
52 // DeviceId returns the device id string.55 // DeviceId returns the device id string.
53 DeviceId() string56 DeviceId() string
57 // Levels returns the current channel levels for the session
58 Levels() LevelsMap
59 // ExchangeScratchArea returns the scratch area for exchanges.
60 ExchangeScratchArea() *ExchangesScratchArea
54}61}
5562
56// Session aborted error.63// Session aborted error.
5764
=== added file 'server/broker/exchanges.go'
--- server/broker/exchanges.go 1970-01-01 00:00:00 +0000
+++ server/broker/exchanges.go 2014-01-24 07:56:28 +0000
@@ -0,0 +1,74 @@
1/*
2 Copyright 2013-2014 Canonical Ltd.
3
4 This program is free software: you can redistribute it and/or modify it
5 under the terms of the GNU General Public License version 3, as published
6 by the Free Software Foundation.
7
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranties of
10 MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 PURPOSE. See the GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License along
14 with this program. If not, see <http://www.gnu.org/licenses/>.
15*/
16
17package broker
18
19import (
20 "encoding/json"
21 "launchpad.net/ubuntu-push/protocol"
22 "launchpad.net/ubuntu-push/server/store"
23 // "log"
24)
25
26// Exchanges
27
28// Scratch area for exchanges, sessions should one of these.
29type ExchangesScratchArea struct {
30 broadcastMsg protocol.BroadcastMsg
31 ackMsg protocol.AckMsg
32}
33
34// BroadcastExchange leads a session through delivering a BROADCAST.
35// For simplicity its fully public.
36type BroadcastExchange struct {
37 ChanId store.InternalChannelId
38 TopLevel int64
39 NotificationPayloads []json.RawMessage
40}
41
42func filterByLevel(clientLevel, topLevel int64, payloads []json.RawMessage) []json.RawMessage {
43 c := int64(len(payloads))
44 delta := topLevel - clientLevel
45 if delta < c {
46 return payloads[c-delta:]
47 } else {
48 return payloads
49 }
50}
51
52// Prepare session for a BROADCAST.
53func (sbe *BroadcastExchange) Prepare(sess BrokerSession) (outMessage protocol.SplittableMsg, inMessage interface{}, err error) {
54 scratchArea := sess.ExchangeScratchArea()
55 scratchArea.broadcastMsg.Type = "broadcast"
56 clientLevel := sess.Levels()[sbe.ChanId]
57 payloads := filterByLevel(clientLevel, sbe.TopLevel, sbe.NotificationPayloads)
58 // xxx need an AppId as well, later
59 scratchArea.broadcastMsg.ChanId = store.InternalChannelIdToHex(sbe.ChanId)
60 scratchArea.broadcastMsg.TopLevel = sbe.TopLevel
61 scratchArea.broadcastMsg.Payloads = payloads
62 return &scratchArea.broadcastMsg, &scratchArea.ackMsg, nil
63}
64
65// Acked deals with an ACK for a BROADCAST.
66func (sbe *BroadcastExchange) Acked(sess BrokerSession) error {
67 scratchArea := sess.ExchangeScratchArea()
68 if scratchArea.ackMsg.Type != "ack" {
69 return &ErrAbort{"expected ACK message"}
70 }
71 // update levels
72 sess.Levels()[sbe.ChanId] = sbe.TopLevel
73 return nil
74}
075
=== added file 'server/broker/exchanges_test.go'
--- server/broker/exchanges_test.go 1970-01-01 00:00:00 +0000
+++ server/broker/exchanges_test.go 2014-01-24 07:56:28 +0000
@@ -0,0 +1,123 @@
1/*
2 Copyright 2013-2014 Canonical Ltd.
3
4 This program is free software: you can redistribute it and/or modify it
5 under the terms of the GNU General Public License version 3, as published
6 by the Free Software Foundation.
7
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranties of
10 MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 PURPOSE. See the GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License along
14 with this program. If not, see <http://www.gnu.org/licenses/>.
15*/
16
17package broker
18
19import (
20 "encoding/json"
21 . "launchpad.net/gocheck"
22 "launchpad.net/ubuntu-push/server/store"
23 // "log"
24)
25
26type exchangesSuite struct{}
27
28var _ = Suite(&exchangesSuite{})
29
30func (s *exchangesSuite) TestBroadcastExchange(c *C) {
31 sess := &simpleBrokerSession{
32 levels: map[store.InternalChannelId]int64{},
33 }
34 exchg := &BroadcastExchange{
35 ChanId: store.SystemInternalChannelId,
36 TopLevel: 3,
37 NotificationPayloads: []json.RawMessage{
38 json.RawMessage(`{"a":"x"}`),
39 json.RawMessage(`{"a":"y"}`),
40 },
41 }
42 inMsg, outMsg, err := exchg.Prepare(sess)
43 c.Assert(err, IsNil)
44 // check
45 marshalled, err := json.Marshal(inMsg)
46 c.Assert(err, IsNil)
47 c.Check(string(marshalled), Equals, `{"T":"broadcast","ChanId":"0","TopLevel":3,"Payloads":[{"a":"x"},{"a":"y"}]}`)
48 err = json.Unmarshal([]byte(`{"T":"ack"}`), outMsg)
49 c.Assert(err, IsNil)
50 err = exchg.Acked(sess)
51 c.Assert(err, IsNil)
52 c.Check(sess.levels[store.SystemInternalChannelId], Equals, int64(3))
53}
54
55func (s *exchangesSuite) TestBroadcastExchangeAckMismatch(c *C) {
56 sess := &simpleBrokerSession{
57 levels: map[store.InternalChannelId]int64{},
58 }
59 exchg := &BroadcastExchange{
60 ChanId: store.SystemInternalChannelId,
61 TopLevel: 3,
62 NotificationPayloads: []json.RawMessage{
63 json.RawMessage(`{"a":"y"}`),
64 },
65 }
66 inMsg, outMsg, err := exchg.Prepare(sess)
67 c.Assert(err, IsNil)
68 // check
69 marshalled, err := json.Marshal(inMsg)
70 c.Assert(err, IsNil)
71 c.Check(string(marshalled), Equals, `{"T":"broadcast","ChanId":"0","TopLevel":3,"Payloads":[{"a":"y"}]}`)
72 err = json.Unmarshal([]byte(`{}`), outMsg)
73 c.Assert(err, IsNil)
74 err = exchg.Acked(sess)
75 c.Assert(err, Not(IsNil))
76 c.Check(sess.levels[store.SystemInternalChannelId], Equals, int64(0))
77}
78
79func (s *exchangesSuite) TestFilterByLevel(c *C) {
80 payloads := []json.RawMessage{
81 json.RawMessage(`{"a": 3}`),
82 json.RawMessage(`{"a": 4}`),
83 json.RawMessage(`{"a": 5}`),
84 }
85 res := filterByLevel(5, 5, payloads)
86 c.Check(len(res), Equals, 0)
87 res = filterByLevel(4, 5, payloads)
88 c.Check(len(res), Equals, 1)
89 c.Check(res[0], DeepEquals, json.RawMessage(`{"a": 5}`))
90 res = filterByLevel(3, 5, payloads)
91 c.Check(len(res), Equals, 2)
92 c.Check(res[0], DeepEquals, json.RawMessage(`{"a": 4}`))
93 res = filterByLevel(2, 5, payloads)
94 c.Check(len(res), Equals, 3)
95 res = filterByLevel(1, 5, payloads)
96 c.Check(len(res), Equals, 3)
97}
98
99func (s *exchangesSuite) TestBroadcastExchangeFilterByLevel(c *C) {
100 sess := &simpleBrokerSession{
101 levels: map[store.InternalChannelId]int64{
102 store.SystemInternalChannelId: 2,
103 },
104 }
105 exchg := &BroadcastExchange{
106 ChanId: store.SystemInternalChannelId,
107 TopLevel: 3,
108 NotificationPayloads: []json.RawMessage{
109 json.RawMessage(`{"a":"x"}`),
110 json.RawMessage(`{"a":"y"}`),
111 },
112 }
113 inMsg, outMsg, err := exchg.Prepare(sess)
114 c.Assert(err, IsNil)
115 // check
116 marshalled, err := json.Marshal(inMsg)
117 c.Assert(err, IsNil)
118 c.Check(string(marshalled), Equals, `{"T":"broadcast","ChanId":"0","TopLevel":3,"Payloads":[{"a":"y"}]}`)
119 err = json.Unmarshal([]byte(`{"T":"ack"}`), outMsg)
120 c.Assert(err, IsNil)
121 err = exchg.Acked(sess)
122 c.Assert(err, IsNil)
123}
0124
=== modified file 'server/broker/simple.go'
--- server/broker/simple.go 2014-01-14 15:35:20 +0000
+++ server/broker/simple.go 2014-01-24 07:56:28 +0000
@@ -17,7 +17,6 @@
17package broker17package broker
1818
19import (19import (
20 "encoding/json"
21 "launchpad.net/ubuntu-push/logger"20 "launchpad.net/ubuntu-push/logger"
22 "launchpad.net/ubuntu-push/protocol"21 "launchpad.net/ubuntu-push/protocol"
23 "launchpad.net/ubuntu-push/server/store"22 "launchpad.net/ubuntu-push/server/store"
@@ -48,10 +47,9 @@
48 deviceId string47 deviceId string
49 done chan bool48 done chan bool
50 exchanges chan Exchange49 exchanges chan Exchange
51 levels map[store.InternalChannelId]int6450 levels LevelsMap
52 // for exchanges51 // for exchanges
53 broadcastMsg protocol.BroadcastMsg52 exchgScratch ExchangesScratchArea
54 ackMsg protocol.AckMsg
55}53}
5654
57type deliveryKind int55type deliveryKind int
@@ -74,6 +72,14 @@
74 return sess.deviceId72 return sess.deviceId
75}73}
7674
75func (sess *simpleBrokerSession) Levels() LevelsMap {
76 return sess.levels
77}
78
79func (sess *simpleBrokerSession) ExchangeScratchArea() *ExchangesScratchArea {
80 return &sess.exchgScratch
81}
82
77// NewSimpleBroker makes a new SimpleBroker.83// NewSimpleBroker makes a new SimpleBroker.
78func NewSimpleBroker(sto store.PendingStore, cfg BrokerConfig, logger logger.Logger) *SimpleBroker {84func NewSimpleBroker(sto store.PendingStore, cfg BrokerConfig, logger logger.Logger) *SimpleBroker {
79 sessionCh := make(chan *simpleBrokerSession, cfg.BrokerQueueSize())85 sessionCh := make(chan *simpleBrokerSession, cfg.BrokerQueueSize())
@@ -126,10 +132,10 @@
126 }132 }
127 clientLevel := sess.levels[chanId]133 clientLevel := sess.levels[chanId]
128 if clientLevel != topLevel {134 if clientLevel != topLevel {
129 broadcastExchg := &simpleBroadcastExchange{135 broadcastExchg := &BroadcastExchange{
130 chanId: chanId,136 ChanId: chanId,
131 topLevel: topLevel,137 TopLevel: topLevel,
132 notificationPayloads: payloads,138 NotificationPayloads: payloads,
133 }139 }
134 sess.exchanges <- broadcastExchg140 sess.exchanges <- broadcastExchg
135 }141 }
@@ -198,10 +204,10 @@
198 b.logger.Errorf("unsuccessful broadcast, get channel snapshot for %v: %v", delivery.chanId, err)204 b.logger.Errorf("unsuccessful broadcast, get channel snapshot for %v: %v", delivery.chanId, err)
199 continue Loop205 continue Loop
200 }206 }
201 broadcastExchg := &simpleBroadcastExchange{207 broadcastExchg := &BroadcastExchange{
202 chanId: delivery.chanId,208 ChanId: delivery.chanId,
203 topLevel: topLevel,209 TopLevel: topLevel,
204 notificationPayloads: payloads,210 NotificationPayloads: payloads,
205 }211 }
206 for _, sess := range b.registry {212 for _, sess := range b.registry {
207 sess.exchanges <- broadcastExchg213 sess.exchanges <- broadcastExchg
@@ -218,43 +224,3 @@
218 chanId: chanId,224 chanId: chanId,
219 }225 }
220}226}
221
222// Exchanges
223
224type simpleBroadcastExchange struct {
225 chanId store.InternalChannelId
226 topLevel int64
227 notificationPayloads []json.RawMessage
228}
229
230func filterByLevel(clientLevel, topLevel int64, payloads []json.RawMessage) []json.RawMessage {
231 c := int64(len(payloads))
232 delta := topLevel - clientLevel
233 if delta < c {
234 return payloads[c-delta:]
235 } else {
236 return payloads
237 }
238}
239
240func (sbe *simpleBroadcastExchange) Prepare(sess BrokerSession) (outMessage protocol.SplittableMsg, inMessage interface{}, err error) {
241 simpleSess := sess.(*simpleBrokerSession)
242 simpleSess.broadcastMsg.Type = "broadcast"
243 clientLevel := simpleSess.levels[sbe.chanId]
244 payloads := filterByLevel(clientLevel, sbe.topLevel, sbe.notificationPayloads)
245 // xxx need an AppId as well, later
246 simpleSess.broadcastMsg.ChanId = store.InternalChannelIdToHex(sbe.chanId)
247 simpleSess.broadcastMsg.TopLevel = sbe.topLevel
248 simpleSess.broadcastMsg.Payloads = payloads
249 return &simpleSess.broadcastMsg, &simpleSess.ackMsg, nil
250}
251
252func (sbe *simpleBroadcastExchange) Acked(sess BrokerSession) error {
253 simpleSess := sess.(*simpleBrokerSession)
254 if simpleSess.ackMsg.Type != "ack" {
255 return &ErrAbort{"expected ACK message"}
256 }
257 // update levels
258 simpleSess.levels[sbe.chanId] = sbe.topLevel
259 return nil
260}
261227
=== modified file 'server/broker/simple_test.go'
--- server/broker/simple_test.go 2014-01-14 15:35:20 +0000
+++ server/broker/simple_test.go 2014-01-24 07:56:28 +0000
@@ -69,9 +69,9 @@
69 c.Assert(err, IsNil)69 c.Assert(err, IsNil)
70 c.Assert(b.registry["dev-1"], Equals, sess)70 c.Assert(b.registry["dev-1"], Equals, sess)
71 c.Assert(sess.DeviceId(), Equals, "dev-1")71 c.Assert(sess.DeviceId(), Equals, "dev-1")
72 c.Check(sess.(*simpleBrokerSession).levels, DeepEquals, map[store.InternalChannelId]int64{72 c.Check(sess.Levels(), DeepEquals, LevelsMap(map[store.InternalChannelId]int64{
73 store.SystemInternalChannelId: 5,73 store.SystemInternalChannelId: 5,
74 })74 }))
75 b.Unregister(sess)75 b.Unregister(sess)
76 // just to make sure the unregister was processed76 // just to make sure the unregister was processed
77 _, err = b.Register(&protocol.ConnectMsg{Type: "connect", DeviceId: ""})77 _, err = b.Register(&protocol.ConnectMsg{Type: "connect", DeviceId: ""})
@@ -99,10 +99,10 @@
99 b.feedPending(sess)99 b.feedPending(sess)
100 c.Assert(len(sess.exchanges), Equals, 1)100 c.Assert(len(sess.exchanges), Equals, 1)
101 exchg1 := <-sess.exchanges101 exchg1 := <-sess.exchanges
102 c.Check(exchg1, DeepEquals, &simpleBroadcastExchange{102 c.Check(exchg1, DeepEquals, &BroadcastExchange{
103 chanId: store.SystemInternalChannelId,103 ChanId: store.SystemInternalChannelId,
104 topLevel: 1,104 TopLevel: 1,
105 notificationPayloads: []json.RawMessage{notification1},105 NotificationPayloads: []json.RawMessage{notification1},
106 })106 })
107}107}
108108
@@ -163,101 +163,6 @@
163 c.Check(b.registry["dev-1"], Equals, sess2)163 c.Check(b.registry["dev-1"], Equals, sess2)
164}164}
165165
166func (s *simpleSuite) TestBroadcastExchange(c *C) {
167 sess := &simpleBrokerSession{
168 levels: map[store.InternalChannelId]int64{},
169 }
170 exchg := &simpleBroadcastExchange{
171 chanId: store.SystemInternalChannelId,
172 topLevel: 3,
173 notificationPayloads: []json.RawMessage{
174 json.RawMessage(`{"a":"x"}`),
175 json.RawMessage(`{"a":"y"}`),
176 },
177 }
178 inMsg, outMsg, err := exchg.Prepare(sess)
179 c.Assert(err, IsNil)
180 // check
181 marshalled, err := json.Marshal(inMsg)
182 c.Assert(err, IsNil)
183 c.Check(string(marshalled), Equals, `{"T":"broadcast","ChanId":"0","TopLevel":3,"Payloads":[{"a":"x"},{"a":"y"}]}`)
184 err = json.Unmarshal([]byte(`{"T":"ack"}`), outMsg)
185 c.Assert(err, IsNil)
186 err = exchg.Acked(sess)
187 c.Assert(err, IsNil)
188 c.Check(sess.levels[store.SystemInternalChannelId], Equals, int64(3))
189}
190
191func (s *simpleSuite) TestBroadcastExchangeAckMismatch(c *C) {
192 sess := &simpleBrokerSession{
193 levels: map[store.InternalChannelId]int64{},
194 }
195 exchg := &simpleBroadcastExchange{
196 chanId: store.SystemInternalChannelId,
197 topLevel: 3,
198 notificationPayloads: []json.RawMessage{
199 json.RawMessage(`{"a":"y"}`),
200 },
201 }
202 inMsg, outMsg, err := exchg.Prepare(sess)
203 c.Assert(err, IsNil)
204 // check
205 marshalled, err := json.Marshal(inMsg)
206 c.Assert(err, IsNil)
207 c.Check(string(marshalled), Equals, `{"T":"broadcast","ChanId":"0","TopLevel":3,"Payloads":[{"a":"y"}]}`)
208 err = json.Unmarshal([]byte(`{}`), outMsg)
209 c.Assert(err, IsNil)
210 err = exchg.Acked(sess)
211 c.Assert(err, Not(IsNil))
212 c.Check(sess.levels[store.SystemInternalChannelId], Equals, int64(0))
213}
214
215func (s *simpleSuite) TestFilterByLevel(c *C) {
216 payloads := []json.RawMessage{
217 json.RawMessage(`{"a": 3}`),
218 json.RawMessage(`{"a": 4}`),
219 json.RawMessage(`{"a": 5}`),
220 }
221 res := filterByLevel(5, 5, payloads)
222 c.Check(len(res), Equals, 0)
223 res = filterByLevel(4, 5, payloads)
224 c.Check(len(res), Equals, 1)
225 c.Check(res[0], DeepEquals, json.RawMessage(`{"a": 5}`))
226 res = filterByLevel(3, 5, payloads)
227 c.Check(len(res), Equals, 2)
228 c.Check(res[0], DeepEquals, json.RawMessage(`{"a": 4}`))
229 res = filterByLevel(2, 5, payloads)
230 c.Check(len(res), Equals, 3)
231 res = filterByLevel(1, 5, payloads)
232 c.Check(len(res), Equals, 3)
233}
234
235func (s *simpleSuite) TestBroadcastExchangeFilterByLevel(c *C) {
236 sess := &simpleBrokerSession{
237 levels: map[store.InternalChannelId]int64{
238 store.SystemInternalChannelId: 2,
239 },
240 }
241 exchg := &simpleBroadcastExchange{
242 chanId: store.SystemInternalChannelId,
243 topLevel: 3,
244 notificationPayloads: []json.RawMessage{
245 json.RawMessage(`{"a":"x"}`),
246 json.RawMessage(`{"a":"y"}`),
247 },
248 }
249 inMsg, outMsg, err := exchg.Prepare(sess)
250 c.Assert(err, IsNil)
251 // check
252 marshalled, err := json.Marshal(inMsg)
253 c.Assert(err, IsNil)
254 c.Check(string(marshalled), Equals, `{"T":"broadcast","ChanId":"0","TopLevel":3,"Payloads":[{"a":"y"}]}`)
255 err = json.Unmarshal([]byte(`{"T":"ack"}`), outMsg)
256 c.Assert(err, IsNil)
257 err = exchg.Acked(sess)
258 c.Assert(err, IsNil)
259}
260
261func (s *simpleSuite) TestBroadcast(c *C) {166func (s *simpleSuite) TestBroadcast(c *C) {
262 sto := store.NewInMemoryPendingStore()167 sto := store.NewInMemoryPendingStore()
263 notification1 := json.RawMessage(`{"m": "M"}`)168 notification1 := json.RawMessage(`{"m": "M"}`)
@@ -274,20 +179,20 @@
274 case <-time.After(5 * time.Second):179 case <-time.After(5 * time.Second):
275 c.Fatal("taking too long to get broadcast exchange")180 c.Fatal("taking too long to get broadcast exchange")
276 case exchg1 := <-sess1.SessionChannel():181 case exchg1 := <-sess1.SessionChannel():
277 c.Check(exchg1, DeepEquals, &simpleBroadcastExchange{182 c.Check(exchg1, DeepEquals, &BroadcastExchange{
278 chanId: store.SystemInternalChannelId,183 ChanId: store.SystemInternalChannelId,
279 topLevel: 1,184 TopLevel: 1,
280 notificationPayloads: []json.RawMessage{notification1},185 NotificationPayloads: []json.RawMessage{notification1},
281 })186 })
282 }187 }
283 select {188 select {
284 case <-time.After(5 * time.Second):189 case <-time.After(5 * time.Second):
285 c.Fatal("taking too long to get broadcast exchange")190 c.Fatal("taking too long to get broadcast exchange")
286 case exchg2 := <-sess2.SessionChannel():191 case exchg2 := <-sess2.SessionChannel():
287 c.Check(exchg2, DeepEquals, &simpleBroadcastExchange{192 c.Check(exchg2, DeepEquals, &BroadcastExchange{
288 chanId: store.SystemInternalChannelId,193 ChanId: store.SystemInternalChannelId,
289 topLevel: 1,194 TopLevel: 1,
290 notificationPayloads: []json.RawMessage{notification1},195 NotificationPayloads: []json.RawMessage{notification1},
291 })196 })
292 }197 }
293}198}
294199
=== modified file 'server/session/session_test.go'
--- server/session/session_test.go 2014-01-15 15:54:20 +0000
+++ server/session/session_test.go 2014-01-24 07:56:28 +0000
@@ -136,6 +136,14 @@
136 return tbs.deviceId136 return tbs.deviceId
137}137}
138138
139func (tbs *testBrokerSession) Levels() broker.LevelsMap {
140 return nil
141}
142
143func (tbs *testBrokerSession) ExchangeScratchArea() *broker.ExchangesScratchArea {
144 return nil
145}
146
139func (tb *testBroker) Register(connect *protocol.ConnectMsg) (broker.BrokerSession, error) {147func (tb *testBroker) Register(connect *protocol.ConnectMsg) (broker.BrokerSession, error) {
140 tb.registration <- "register " + connect.DeviceId148 tb.registration <- "register " + connect.DeviceId
141 return &testBrokerSession{connect.DeviceId, nil}, tb.err149 return &testBrokerSession{connect.DeviceId, nil}, tb.err

Subscribers

People subscribed via source and target branches