Merge lp:~chipaca/ubuntu-push/fix-1383867--trunk into lp:ubuntu-push

Proposed by John Lenton
Status: Merged
Approved by: John Lenton
Approved revision: 133
Merged at revision: 133
Proposed branch: lp:~chipaca/ubuntu-push/fix-1383867--trunk
Merge into: lp:ubuntu-push
Diff against target: 63 lines (+12/-7)
3 files modified
client/service/common.go (+6/-1)
client/service/postal.go (+5/-5)
client/service/service.go (+1/-1)
To merge this branch: bzr merge lp:~chipaca/ubuntu-push/fix-1383867--trunk
Reviewer Review Type Date Requested Status
John Lenton (community) Approve
Review via email: mp+239377@code.launchpad.net

Commit message

make the common service Start(..) method take init, so we can listen for methods once everything is set up and not before.

Description of the change

make the common service Start(..) method take init, so we can listen for methods once everything is set up and not before.

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

this branch has been approved by pedronis (sitting here beside me).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'client/service/common.go'
--- client/service/common.go 2014-08-06 02:48:10 +0000
+++ client/service/common.go 2014-10-23 14:40:55 +0000
@@ -63,7 +63,7 @@
63}63}
6464
65// Start() dials the bus, grab the name, and listens for method calls.65// Start() dials the bus, grab the name, and listens for method calls.
66func (svc *DBusService) Start(dispatchMap bus.DispatchMap, busAddr bus.Address) error {66func (svc *DBusService) Start(dispatchMap bus.DispatchMap, busAddr bus.Address, init func() error) error {
67 svc.lock.Lock()67 svc.lock.Lock()
68 defer svc.lock.Unlock()68 defer svc.lock.Unlock()
69 if svc.state != StateUnknown {69 if svc.state != StateUnknown {
@@ -89,6 +89,11 @@
89 }89 }
90 }90 }
91 }()91 }()
92 if init != nil {
93 if err = init(); err != nil {
94 return err
95 }
96 }
92 svc.Bus.WatchMethod(dispatchMap, "/*", svc)97 svc.Bus.WatchMethod(dispatchMap, "/*", svc)
93 svc.state = StateRunning98 svc.state = StateRunning
94 return nil99 return nil
95100
=== modified file 'client/service/postal.go'
--- client/service/postal.go 2014-09-09 20:46:45 +0000
+++ client/service/postal.go 2014-10-23 14:40:55 +0000
@@ -141,16 +141,16 @@
141141
142// Start() dials the bus, grab the name, and listens for method calls.142// Start() dials the bus, grab the name, and listens for method calls.
143func (svc *PostalService) Start() error {143func (svc *PostalService) Start() error {
144 err := svc.DBusService.Start(bus.DispatchMap{144 return svc.DBusService.Start(bus.DispatchMap{
145 "PopAll": svc.popAll,145 "PopAll": svc.popAll,
146 "Post": svc.post,146 "Post": svc.post,
147 "ListPersistent": svc.listPersistent,147 "ListPersistent": svc.listPersistent,
148 "ClearPersistent": svc.clearPersistent,148 "ClearPersistent": svc.clearPersistent,
149 "SetCounter": svc.setCounter,149 "SetCounter": svc.setCounter,
150 }, PostalServiceBusAddress)150 }, PostalServiceBusAddress, svc.init)
151 if err != nil {151}
152 return err152
153 }153func (svc *PostalService) init() error {
154 actionsCh, err := svc.takeTheBus()154 actionsCh, err := svc.takeTheBus()
155 if err != nil {155 if err != nil {
156 return err156 return err
157157
=== modified file 'client/service/service.go'
--- client/service/service.go 2014-07-14 19:51:43 +0000
+++ client/service/service.go 2014-10-23 14:40:55 +0000
@@ -89,7 +89,7 @@
89 return svc.DBusService.Start(bus.DispatchMap{89 return svc.DBusService.Start(bus.DispatchMap{
90 "Register": svc.register,90 "Register": svc.register,
91 "Unregister": svc.unregister,91 "Unregister": svc.unregister,
92 }, PushServiceBusAddress)92 }, PushServiceBusAddress, nil)
93}93}
9494
95var (95var (

Subscribers

People subscribed via source and target branches