Merge lp:~thomas-voss/location-service/fix-1462664 into lp:location-service/15.04

Proposed by Thomas Voß
Status: Merged
Approved by: Alberto Mardegan
Approved revision: 199
Merged at revision: 199
Proposed branch: lp:~thomas-voss/location-service/fix-1462664
Merge into: lp:location-service/15.04
Diff against target: 93 lines (+25/-26)
2 files modified
src/location_service/com/ubuntu/location/service/daemon.cpp (+4/-23)
src/location_service/com/ubuntu/location/service/session/skeleton.cpp (+21/-3)
To merge this branch: bzr merge lp:~thomas-voss/location-service/fix-1462664
Reviewer Review Type Date Requested Status
Alberto Mardegan (community) Approve
Review via email: mp+275537@code.launchpad.net

This proposal supersedes a proposal from 2015-10-22.

Commit message

Handle responses of clients to updates asynchronously.
Rely on dummy::ConnectivityManager as harvesting is disabled anyway.

Description of the change

Handle responses of clients to updates asynchronously.
Rely on dummy::ConnectivityManager as harvesting is disabled anyway.

To post a comment you must log in.
Revision history for this message
Alberto Mardegan (mardy) wrote : Posted in a previous version of this proposal

All the messages say "Failed to communicate position update to client: ", but the last two could say "heading" and "velocity", respectively. Just in case we want to be able to tell apart the cases in the logs.

Which I don't think is really important, that's why I'm approving this as it is anyway.

review: Approve
Revision history for this message
Alberto Mardegan (mardy) wrote : Posted in a previous version of this proposal

But, how does this fixes the linked issues? The methods where already invoked asynchronously; this just adds error logging (which is good).

Revision history for this message
Thomas Voß (thomas-voss) wrote : Posted in a previous version of this proposal

The previous *async* methods returned a std::future<core::dbus::Result<..>>, which tries to synchronize its state on destruction. Please also note that I'm proposing this early to enable testing easily.

Revision history for this message
Alberto Mardegan (mardy) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/location_service/com/ubuntu/location/service/daemon.cpp'
2--- src/location_service/com/ubuntu/location/service/daemon.cpp 2015-04-16 10:03:29 +0000
3+++ src/location_service/com/ubuntu/location/service/daemon.cpp 2015-10-23 13:49:32 +0000
4@@ -20,6 +20,8 @@
5 #include <com/ubuntu/location/boost_ptree_settings.h>
6 #include <com/ubuntu/location/provider_factory.h>
7
8+#include <com/ubuntu/location/connectivity/dummy_connectivity_manager.h>
9+
10 #include <com/ubuntu/location/service/default_configuration.h>
11 #include <com/ubuntu/location/service/demultiplexing_reporter.h>
12 #include <com/ubuntu/location/service/ichnaea_reporter.h>
13@@ -214,29 +216,8 @@
14 dc.the_permission_manager(config.outgoing),
15 location::service::Harvester::Configuration
16 {
17- location::connectivity::platform_default_manager(),
18- // We submit location/wifi/cell measurements to both
19- // Mozilla's location service and to Ubuntu's own instance.
20- std::make_shared<service::DemultiplexingReporter>(
21- std::initializer_list<service::Harvester::Reporter::Ptr>
22- {
23- std::make_shared<service::ichnaea::Reporter>(
24- service::ichnaea::Reporter::Configuration
25- {
26- "https://location.services.mozilla.com",
27- "UbuntuLocationService",
28- "UbuntuLocationService"
29- }
30- ),
31- std::make_shared<service::ichnaea::Reporter>(
32- service::ichnaea::Reporter::Configuration
33- {
34- "https://162.213.35.107",
35- "UbuntuLocationService",
36- "UbuntuLocationService"
37- }
38- )
39- })
40+ std::make_shared<dummy::ConnectivityManager>(),
41+ std::make_shared<NullReporter>()
42 }
43 };
44
45
46=== modified file 'src/location_service/com/ubuntu/location/service/session/skeleton.cpp'
47--- src/location_service/com/ubuntu/location/service/session/skeleton.cpp 2014-08-14 20:31:09 +0000
48+++ src/location_service/com/ubuntu/location/service/session/skeleton.cpp 2015-10-23 13:49:32 +0000
49@@ -283,7 +283,13 @@
50 VLOG(10) << __PRETTY_FUNCTION__;
51 try
52 {
53- configuration.remote.object->invoke_method_asynchronously<culs::session::Interface::UpdatePosition, void>(position);
54+ configuration.remote.object->invoke_method_asynchronously_with_callback<culs::session::Interface::UpdatePosition, void>([](const core::dbus::Result<void>& result)
55+ {
56+ if (result.is_error())
57+ {
58+ LOG(INFO) << "Failed to communicate position update to client: " << result.error().print();
59+ }
60+ }, position);
61 } catch(const std::exception&)
62 {
63 // We consider the session to be dead once we hit an exception here.
64@@ -300,7 +306,13 @@
65 VLOG(10) << __PRETTY_FUNCTION__;
66 try
67 {
68- configuration.remote.object->invoke_method_asynchronously<culs::session::Interface::UpdateHeading, void>(heading);
69+ configuration.remote.object->invoke_method_asynchronously_with_callback<culs::session::Interface::UpdateHeading, void>([](const core::dbus::Result<void>& result)
70+ {
71+ if (result.is_error())
72+ {
73+ LOG(INFO) << "Failed to communicate position update to client: " << result.error().print();
74+ }
75+ }, heading);
76 } catch(const std::exception&)
77 {
78 // We consider the session to be dead once we hit an exception here.
79@@ -317,7 +329,13 @@
80 VLOG(10) << __PRETTY_FUNCTION__;
81 try
82 {
83- configuration.remote.object->invoke_method_asynchronously<culs::session::Interface::UpdateVelocity, void>(velocity);
84+ configuration.remote.object->invoke_method_asynchronously_with_callback<culs::session::Interface::UpdateVelocity, void>([](const core::dbus::Result<void>& result)
85+ {
86+ if (result.is_error())
87+ {
88+ LOG(INFO) << "Failed to communicate position update to client: " << result.error().print();
89+ }
90+ }, velocity);
91 } catch(const std::exception&)
92 {
93 // We consider the session to be dead once we hit an exception here.

Subscribers

People subscribed via source and target branches