diff options
author | Thomas Haller <thaller@redhat.com> | 2019-12-06 13:02:31 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-12-10 07:53:25 +0100 |
commit | 8897bb75e248818f297f3b72ccab20ace4c968b8 (patch) | |
tree | 230393b308313f7ca820e1b8aedf3355e4deb2a5 | |
parent | 691af7d32522ed89a555ca1a5919c626b0c2c2a6 (diff) | |
download | NetworkManager-8897bb75e248818f297f3b72ccab20ace4c968b8.tar.gz |
tui: create NMClient instance via async init
Using sync init (nm_client_new()) has an overhead as it requires an internal
GMainContext to ensure preserving the order of D-Bus messages. Let's avoid
that by using the async init. Note that the difference here is that we will
iterate the caller's GMainContext while creating the instance. But that
is no problem for nmtui at that point.
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | clients/tui/meson.build | 1 | ||||
-rw-r--r-- | clients/tui/nmtui.c | 8 |
3 files changed, 8 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am index 748c0c9ef2..6c29e44ff2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4640,6 +4640,7 @@ clients_tui_nmtui_LDADD = \ clients/tui/newt/libnmt-newt.a \ clients/common/libnmc.la \ clients/common/libnmc-base.la \ + shared/nm-libnm-aux/libnm-libnm-aux.la \ shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \ shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \ shared/nm-glib-aux/libnm-glib-aux.la \ diff --git a/clients/tui/meson.build b/clients/tui/meson.build index 8948d6ff35..db6bd429fd 100644 --- a/clients/tui/meson.build +++ b/clients/tui/meson.build @@ -51,6 +51,7 @@ deps = [ libnmc_base_dep, libnmc_dep, libnmt_newt_dep, + libnm_libnm_aux_dep, ] executable( diff --git a/clients/tui/nmtui.c b/clients/tui/nmtui.c index e9d2ab506b..dcd8973772 100644 --- a/clients/tui/nmtui.c +++ b/clients/tui/nmtui.c @@ -18,6 +18,8 @@ #include <locale.h> #include <stdlib.h> +#include "nm-libnm-aux/nm-libnm-aux.h" + #include "nmt-newt.h" #include "nm-editor-bindings.h" @@ -231,8 +233,10 @@ main (int argc, char **argv) nm_editor_bindings_init (); - nm_client = nm_client_new (NULL, &error); - if (!nm_client) { + if (!nmc_client_new_waitsync (NULL, + &nm_client, + &error, + NULL)) { g_printerr (_("Could not contact NetworkManager: %s.\n"), error->message); g_error_free (error); exit (1); |