Merge lp:~thomas-voss/location-service/make-client-resilient-against-service-going-away into lp:location-service

Proposed by Thomas Voß
Status: Merged
Approved by: Thomas Voß
Approved revision: 295
Merged at revision: 295
Proposed branch: lp:~thomas-voss/location-service/make-client-resilient-against-service-going-away
Merge into: lp:location-service
Diff against target: 72 lines (+27/-18)
1 file modified
src/location/dbus/stub/session.cpp (+27/-18)
To merge this branch: bzr merge lp:~thomas-voss/location-service/make-client-resilient-against-service-going-away
Reviewer Review Type Date Requested Status
Simon Fels (community) Approve
Thomas Voß Pending
Review via email: mp+319641@code.launchpad.net

Commit message

Make stub::Session resilient against the service going away.

Description of the change

Make stub::Session resilient against the service going away.

To post a comment you must log in.
Revision history for this message
Simon Fels (morphis) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/location/dbus/stub/session.cpp'
2--- src/location/dbus/stub/session.cpp 2017-03-04 21:43:23 +0000
3+++ src/location/dbus/stub/session.cpp 2017-03-11 21:15:41 +0000
4@@ -191,13 +191,16 @@
5 {
6 if (auto thiz = holder->value.lock())
7 {
8- auto update =
9- location::dbus::decode<
10- location::Update<location::Position>
11- >(com_ubuntu_location_service_session_get_position(thiz->session_.get()));
12+ if (auto variant = com_ubuntu_location_service_session_get_position(thiz->session_.get()))
13+ {
14+ auto update =
15+ location::dbus::decode<
16+ location::Update<location::Position>
17+ >(variant);
18
19- if (update)
20- thiz->updates().position = *update;
21+ if (update)
22+ thiz->updates().position = *update;
23+ }
24 }
25 }
26 }
27@@ -212,13 +215,16 @@
28 {
29 if (auto thiz = holder->value.lock())
30 {
31- auto update =
32- location::dbus::decode<
33- location::Update<units::Degrees>
34- >(com_ubuntu_location_service_session_get_heading(thiz->session_.get()));
35+ if (auto variant = com_ubuntu_location_service_session_get_heading(thiz->session_.get()))
36+ {
37+ auto update =
38+ location::dbus::decode<
39+ location::Update<units::Degrees>
40+ >(variant);
41
42- if (update)
43- thiz->updates().heading = *update;
44+ if (update)
45+ thiz->updates().heading = *update;
46+ }
47 }
48 }
49 }
50@@ -233,13 +239,16 @@
51 {
52 if (auto thiz = holder->value.lock())
53 {
54- auto update =
55- location::dbus::decode<
56- location::Update<units::MetersPerSecond>
57- >(com_ubuntu_location_service_session_get_velocity(thiz->session_.get()));
58+ if (auto variant = com_ubuntu_location_service_session_get_velocity(thiz->session_.get()))
59+ {
60+ auto update =
61+ location::dbus::decode<
62+ location::Update<units::MetersPerSecond>
63+ >(variant);
64
65- if (update)
66- thiz->updates().velocity = *update;
67+ if (update)
68+ thiz->updates().velocity = *update;
69+ }
70 }
71 }
72 }

Subscribers

People subscribed via source and target branches

to all changes: