Merge lp:~jpakkane/indicator-network/grace into lp:indicator-network/14.10

Proposed by Jussi Pakkanen
Status: Merged
Approved by: Antti Kaijanmäki
Approved revision: 416
Merged at revision: 414
Proposed branch: lp:~jpakkane/indicator-network/grace
Merge into: lp:indicator-network/14.10
Diff against target: 52 lines (+25/-17)
1 file modified
src/connectivity-cpp/src/platform/nmofono/wifi/link.cpp (+25/-17)
To merge this branch: bzr merge lp:~jpakkane/indicator-network/grace
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Antti Kaijanmäki (community) Approve
Review via email: mp+232194@code.launchpad.net

Commit message

Exit gracefully on dbus error conditions.

Description of the change

As requested by Antti, in case of irrecoverable dbus-cpp bugs, print out an error message and exit gracefully.

To post a comment you must log in.
Antti Kaijanmäki (kaijanmaki) wrote :

See inlined comments (r414).

review: Needs Fixing
lp:~jpakkane/indicator-network/grace updated
415. By Jussi Pakkanen on 2014-08-26

Fixed review issues.

Jussi Pakkanen (jpakkane) wrote :

DBus bug here: https://bugs.launchpad.net/dbus-cpp/+bug/1361642

Other issues fixed.

Antti Kaijanmäki (kaijanmaki) wrote :

> DBus bug here: https://bugs.launchpad.net/dbus-cpp/+bug/1361642
>
> Other issues fixed.

Thanks! please add this bug link to the catch{} section.

// @bug default timeout expired: LP(#1361642)

review: Needs Fixing
lp:~jpakkane/indicator-network/grace updated
416. By Jussi Pakkanen on 2014-08-26

Link the bug.

Jussi Pakkanen (jpakkane) wrote :

Added.

Antti Kaijanmäki (kaijanmaki) wrote :

Wunderbar!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/connectivity-cpp/src/platform/nmofono/wifi/link.cpp'
--- src/connectivity-cpp/src/platform/nmofono/wifi/link.cpp 2014-08-19 19:55:15 +0000
+++ src/connectivity-cpp/src/platform/nmofono/wifi/link.cpp 2014-08-26 13:21:02 +0000
@@ -359,23 +359,31 @@
359 /// @todo oh, and check more parameters than just the ssid359 /// @todo oh, and check more parameters than just the ssid
360360
361 core::dbus::types::ObjectPath ac;361 core::dbus::types::ObjectPath ac;
362 if (found) {362 try {
363 ac = p->nm.activate_connection(found->object->path(),363 if (found) {
364 p->dev.object->path(),364 ac = p->nm.activate_connection(found->object->path(),
365 ap->object_path());365 p->dev.object->path(),
366 } else {366 ap->object_path());
367 std::map<std::string, std::map<std::string, dbus::types::Variant> > conf;367 } else {
368368 std::map<std::string, std::map<std::string, dbus::types::Variant> > conf;
369 /// @todo getting the ssid multiple times over dbus is stupid.369
370370 /// @todo getting the ssid multiple times over dbus is stupid.
371 std::map<std::string, dbus::types::Variant> wireless_conf;371
372 wireless_conf["ssid"] = dbus::types::Variant::encode<std::vector<std::int8_t>>(ap->get_ap().ssid->get());372 std::map<std::string, dbus::types::Variant> wireless_conf;
373373 wireless_conf["ssid"] = dbus::types::Variant::encode<std::vector<std::int8_t>>(ap->get_ap().ssid->get());
374 conf["802-11-wireless"] = wireless_conf;374
375 auto ret = p->nm.add_and_activate_connection(conf,375 conf["802-11-wireless"] = wireless_conf;
376 p->dev.object->path(),376 auto ret = p->nm.add_and_activate_connection(conf,
377 ap->object_path());377 p->dev.object->path(),
378 ac = std::get<1>(ret);378 ap->object_path());
379 ac = std::get<1>(ret);
380 }
381 } catch(const std::exception &e) {
382 // @bug default timeout expired: LP(#1361642)
383 // If this happens, indicator-network is in an unknown state with no clear way of
384 // recovering. The only reasonable way out is a graceful exit.
385 std::cerr << __PRETTY_FUNCTION__ << " Failed to activate connection: " << e.what() << std::endl;
386 exit(0);
379 }387 }
380 updateActiveConnection(ac);388 updateActiveConnection(ac);
381 p->connecting = false;389 p->connecting = false;

Subscribers

People subscribed via source and target branches