Re: [PATCH] Create a loop for dbus and pump the loop to process all the

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



+1 from me as well as clumens from last night.  The message never showed
up in the queue last night, so I reviewed it via fpaste.org.

Committed and built.

However, two anaconda people did review it before committing, so we held
to the rules.

Jesse Keating wrote:
> 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.
> ---
>  loader/net.c |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/loader/net.c b/loader/net.c
> index eef0234..4d08d34 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;
>  }


-- 
David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux