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
=== modified file 'src/location_service/com/ubuntu/location/connectivity/ofono.h'
--- src/location_service/com/ubuntu/location/connectivity/ofono.h 2014-10-09 13:02:08 +0000
+++ src/location_service/com/ubuntu/location/connectivity/ofono.h 2015-01-06 12:37:51 +0000
@@ -612,10 +612,13 @@
612 }612 }
613613
614 template<typename Property>614 template<typename Property>
615 typename Property::ValueType get() const615 typename Property::ValueType get(bool refresh = true) const
616 { 616 {
617 if (not refresh_properties())617 if (refresh)
618 return typename Property::ValueType{};618 {
619 if (not refresh_properties())
620 return typename Property::ValueType{};
621 }
619622
620 auto it = properties.find(Property::name());623 auto it = properties.find(Property::name());
621624
622625
=== modified file 'src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.cpp'
--- src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.cpp 2014-11-10 20:12:56 +0000
+++ src/location_service/com/ubuntu/location/connectivity/ofono_nm_connectivity_manager.cpp 2015-01-06 12:37:51 +0000
@@ -286,24 +286,6 @@
286 signals.connected_cell_removed(sp);286 signals.connected_cell_removed(sp);
287 });287 });
288288
289 // And we react to changes to the roaming state.
290 cell_result.first->second->is_roaming().changed().connect([this](bool roaming)
291 {
292 VLOG(10) << "Roaming state of cell changed: " << std::boolalpha << roaming << std::endl;
293
294 // Unblocking the bus here and scheduling re-evaluation of the
295 // active connection characteristics.
296 dispatcher.service.post([this]()
297 {
298 // Bail out if the network manager instance went away.
299 if (not network_manager)
300 return;
301
302 active_connection_characteristics.set(
303 characteristics_for_connection(
304 network_manager->properties.primary_connection->get()));
305 });
306 });
307 // Cool, we have reached here, updated all our caches and created a connected radio cell.289 // Cool, we have reached here, updated all our caches and created a connected radio cell.
308 // We are thus good to go and release the lock manually prior to announcing the new cell290 // We are thus good to go and release the lock manually prior to announcing the new cell
309 // to interested parties.291 // to interested parties.
@@ -652,17 +634,12 @@
652 ac.enumerate_devices([this, &characteristics](const core::dbus::types::ObjectPath& path)634 ac.enumerate_devices([this, &characteristics](const core::dbus::types::ObjectPath& path)
653 {635 {
654 xdg::NetworkManager::Device::Type type{xdg::NetworkManager::Device::Type::unknown};636 xdg::NetworkManager::Device::Type type{xdg::NetworkManager::Device::Type::unknown};
655
656 {637 {
638 // We only consider cached devices and do not reach out to enumerate all of the devices
639 // to prevent from excessive dbus roundtrips.
657 std::lock_guard<std::mutex> lg{cached.guard};640 std::lock_guard<std::mutex> lg{cached.guard};
658 if (cached.wireless_devices.count(path) > 0)641 if (cached.wireless_devices.count(path) > 0)
659 type = cached.wireless_devices.at(path).type();642 type = cached.wireless_devices.at(path).type();
660 else
661 type = xdg::NetworkManager::Device
662 {
663 network_manager->service,
664 network_manager->service->object_for_path(path)
665 }.type();
666 }643 }
667644
668 // We interpret a primary connection over a modem device as645 // We interpret a primary connection over a modem device as
@@ -681,7 +658,7 @@
681 // This call might throw as it reaches out to ofono to query the current status of the modem.658 // This call might throw as it reaches out to ofono to query the current status of the modem.
682 try659 try
683 {660 {
684 auto status = pair.second.network_registration.get<org::Ofono::Manager::Modem::NetworkRegistration::Status>();661 auto status = pair.second.network_registration.get<org::Ofono::Manager::Modem::NetworkRegistration::Status>(false);
685 if (org::Ofono::Manager::Modem::NetworkRegistration::Status::roaming == status)662 if (org::Ofono::Manager::Modem::NetworkRegistration::Status::roaming == status)
686 characteristics = characteristics | connectivity::Characteristics::connection_is_roaming;663 characteristics = characteristics | connectivity::Characteristics::connection_is_roaming;
687 }664 }

Subscribers

People subscribed via source and target branches