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

Proposed by Jussi Pakkanen on 2014-08-26
Status: Merged
Approved by: Antti Kaijanmäki on 2014-08-26
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 on 2014-08-26
Antti Kaijanmäki (community) 2014-08-26 Approve on 2014-08-26
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 on 2014-08-26
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 on 2014-08-26
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
1=== modified file 'src/connectivity-cpp/src/platform/nmofono/wifi/link.cpp'
2--- src/connectivity-cpp/src/platform/nmofono/wifi/link.cpp 2014-08-19 19:55:15 +0000
3+++ src/connectivity-cpp/src/platform/nmofono/wifi/link.cpp 2014-08-26 13:21:02 +0000
4@@ -359,23 +359,31 @@
5 /// @todo oh, and check more parameters than just the ssid
6
7 core::dbus::types::ObjectPath ac;
8- if (found) {
9- ac = p->nm.activate_connection(found->object->path(),
10- p->dev.object->path(),
11- ap->object_path());
12- } else {
13- std::map<std::string, std::map<std::string, dbus::types::Variant> > conf;
14-
15- /// @todo getting the ssid multiple times over dbus is stupid.
16-
17- std::map<std::string, dbus::types::Variant> wireless_conf;
18- wireless_conf["ssid"] = dbus::types::Variant::encode<std::vector<std::int8_t>>(ap->get_ap().ssid->get());
19-
20- conf["802-11-wireless"] = wireless_conf;
21- auto ret = p->nm.add_and_activate_connection(conf,
22- p->dev.object->path(),
23- ap->object_path());
24- ac = std::get<1>(ret);
25+ try {
26+ if (found) {
27+ ac = p->nm.activate_connection(found->object->path(),
28+ p->dev.object->path(),
29+ ap->object_path());
30+ } else {
31+ std::map<std::string, std::map<std::string, dbus::types::Variant> > conf;
32+
33+ /// @todo getting the ssid multiple times over dbus is stupid.
34+
35+ std::map<std::string, dbus::types::Variant> wireless_conf;
36+ wireless_conf["ssid"] = dbus::types::Variant::encode<std::vector<std::int8_t>>(ap->get_ap().ssid->get());
37+
38+ conf["802-11-wireless"] = wireless_conf;
39+ auto ret = p->nm.add_and_activate_connection(conf,
40+ p->dev.object->path(),
41+ ap->object_path());
42+ ac = std::get<1>(ret);
43+ }
44+ } catch(const std::exception &e) {
45+ // @bug default timeout expired: LP(#1361642)
46+ // If this happens, indicator-network is in an unknown state with no clear way of
47+ // recovering. The only reasonable way out is a graceful exit.
48+ std::cerr << __PRETTY_FUNCTION__ << " Failed to activate connection: " << e.what() << std::endl;
49+ exit(0);
50 }
51 updateActiveConnection(ac);
52 p->connecting = false;

Subscribers

People subscribed via source and target branches