Merge lp:~thomas-voss/location-service/fix-1394204 into lp:location-service/trunk

Proposed by Thomas Voß
Status: Merged
Approved by: Loïc Minier
Approved revision: 154
Merged at revision: 154
Proposed branch: lp:~thomas-voss/location-service/fix-1394204
Merge into: lp:location-service/trunk
Diff against target: 80 lines (+11/-31)
2 files modified
src/location_service/com/ubuntu/location/connectivity/ofono.h (+7/-4)
src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.cpp (+4/-27)
To merge this branch: bzr merge lp:~thomas-voss/location-service/fix-1394204
Reviewer Review Type Date Requested Status
Loïc Minier Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+245644@code.launchpad.net

Commit message

Fix #1394204 by:

(1.) Relying on the cached devices for querying device properties. This is sufficient, as the cache is always consistent in this particular scenario.
(2.) Not explicitly reacting to modem state changes coming in via Ofono but instead only reacting to changes to the PrimaryConnection property of NetworkManager.

Description of the change

Fix #1394204 by:

(1.) Relying on the cached devices for querying device properties. This is sufficient, as the cache is always consistent in this particular scenario.
(2.) Not explicitly reacting to modem state changes coming in via Ofono but instead only reacting to changes to the PrimaryConnection property of NetworkManager.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Loïc Minier (lool) wrote :

This looks good to me, albeit I didn't finish reviewing the various code pathes; I did test binaries and it worked fine for me (but I wasn't experiencing the dbus load)

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/connectivity/ofono.h'
2--- src/location_service/com/ubuntu/location/connectivity/ofono.h 2014-10-09 13:02:08 +0000
3+++ src/location_service/com/ubuntu/location/connectivity/ofono.h 2015-01-06 12:37:51 +0000
4@@ -612,10 +612,13 @@
5 }
6
7 template<typename Property>
8- typename Property::ValueType get() const
9- {
10- if (not refresh_properties())
11- return typename Property::ValueType{};
12+ typename Property::ValueType get(bool refresh = true) const
13+ {
14+ if (refresh)
15+ {
16+ if (not refresh_properties())
17+ return typename Property::ValueType{};
18+ }
19
20 auto it = properties.find(Property::name());
21
22
23=== modified file 'src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.cpp'
24--- src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.cpp 2014-11-10 20:12:56 +0000
25+++ src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.cpp 2015-01-06 12:37:51 +0000
26@@ -286,24 +286,6 @@
27 signals.connected_cell_removed(sp);
28 });
29
30- // And we react to changes to the roaming state.
31- cell_result.first->second->is_roaming().changed().connect([this](bool roaming)
32- {
33- VLOG(10) << "Roaming state of cell changed: " << std::boolalpha << roaming << std::endl;
34-
35- // Unblocking the bus here and scheduling re-evaluation of the
36- // active connection characteristics.
37- dispatcher.service.post([this]()
38- {
39- // Bail out if the network manager instance went away.
40- if (not network_manager)
41- return;
42-
43- active_connection_characteristics.set(
44- characteristics_for_connection(
45- network_manager->properties.primary_connection->get()));
46- });
47- });
48 // Cool, we have reached here, updated all our caches and created a connected radio cell.
49 // We are thus good to go and release the lock manually prior to announcing the new cell
50 // to interested parties.
51@@ -652,17 +634,12 @@
52 ac.enumerate_devices([this, &characteristics](const core::dbus::types::ObjectPath& path)
53 {
54 xdg::NetworkManager::Device::Type type{xdg::NetworkManager::Device::Type::unknown};
55-
56 {
57+ // We only consider cached devices and do not reach out to enumerate all of the devices
58+ // to prevent from excessive dbus roundtrips.
59 std::lock_guard<std::mutex> lg{cached.guard};
60 if (cached.wireless_devices.count(path) > 0)
61- type = cached.wireless_devices.at(path).type();
62- else
63- type = xdg::NetworkManager::Device
64- {
65- network_manager->service,
66- network_manager->service->object_for_path(path)
67- }.type();
68+ type = cached.wireless_devices.at(path).type();
69 }
70
71 // We interpret a primary connection over a modem device as
72@@ -681,7 +658,7 @@
73 // This call might throw as it reaches out to ofono to query the current status of the modem.
74 try
75 {
76- auto status = pair.second.network_registration.get<org::Ofono::Manager::Modem::NetworkRegistration::Status>();
77+ auto status = pair.second.network_registration.get<org::Ofono::Manager::Modem::NetworkRegistration::Status>(false);
78 if (org::Ofono::Manager::Modem::NetworkRegistration::Status::roaming == status)
79 characteristics = characteristics | connectivity::Characteristics::connection_is_roaming;
80 }

Subscribers

People subscribed via source and target branches