summaryrefslogtreecommitdiffstats
path: root/loader
diff options
context:
space:
mode:
authorJesse Keating <jkeating@redhat.com>2009-01-14 16:18:05 -0800
committerDavid Cantrell <dcantrell@redhat.com>2009-01-14 14:47:18 -1000
commitd7ae1e35d892c50ee33213e7a95b6347cdaaf45d (patch)
tree05e69b8c8b66f0962234ddf4102aa6014c3ce78a /loader
parent6cd324ce80b4573df809d201e67122c259729fcd (diff)
downloadanaconda-d7ae1e35d892c50ee33213e7a95b6347cdaaf45d.tar.gz
anaconda-d7ae1e35d892c50ee33213e7a95b6347cdaaf45d.tar.xz
anaconda-d7ae1e35d892c50ee33213e7a95b6347cdaaf45d.zip
Create a loop for dbus and pump the loop to process all the dbus messages. This fixes network bringup in loader.
In a normal env, something like GTK processes all the dbus messages as part of it's main loop. We don't have anything like that in loader so we have to turn that crank manually, and enough times to clear out all the pending messages. Signed-off-by: David Cantrell <dcantrell@redhat.com>
Diffstat (limited to 'loader')
-rw-r--r--loader/net.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/loader/net.c b/loader/net.c
index eef0234c1..4d08d3437 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -1895,6 +1895,8 @@ int get_connection(iface_t *iface) {
int count = 0;
NMClient *client = NULL;
NMState state;
+ GMainLoop *loop;
+ GMainContext *ctx;
if (iface == NULL) {
return 1;
@@ -1921,8 +1923,21 @@ int get_connection(iface_t *iface) {
return 2;
}
+ /* Create a loop for processing dbus signals */
+ loop = g_main_loop_new(NULL, FALSE);
+ ctx = g_main_loop_get_context(loop);
+
+ /* pump the loop until all the messages are clear */
+ while (g_main_context_pending (ctx)) {
+ g_main_context_iteration (ctx, FALSE);
+ }
+
/* send message and block until a reply or error comes back */
while (count < 45) {
+ /* pump the loop again to clear the messages */
+ while (g_main_context_pending (ctx)) {
+ g_main_context_iteration (ctx, FALSE);
+ }
state = nm_client_get_state(client);
if (state == NM_STATE_CONNECTED) {
@@ -1937,6 +1952,7 @@ int get_connection(iface_t *iface) {
count++;
}
+ g_main_loop_unref(loop);
g_object_unref(client);
return 3;
}