> > From: Victor Toso <me@xxxxxxxxxxxxxx> > > This is mostly a preparatory patch to reduce the usage of globals and > the GMainLoop integration. The changes target one function by: > > * Changing its name from client_setup() to client_setup_sync(): As it > important to clarify that the function block; > > * Removing the 'reconnect' argument as the input is the global > 'do_daemonize'. We can use the global here as it is related to > command line options; > > * Changing the return value from 'int' to 'udscs_connection *' as the > followup patch will remove the global variable 'client'. > > Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx> Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx> Frediano > --- > src/vdagent/vdagent.c | 17 ++++++++++------- > 1 file changed, 10 insertions(+), 7 deletions(-) > > diff --git a/src/vdagent/vdagent.c b/src/vdagent/vdagent.c > index 0bb631f..ac6e732 100644 > --- a/src/vdagent/vdagent.c > +++ b/src/vdagent/vdagent.c > @@ -230,18 +230,20 @@ static void daemon_read_complete(struct > udscs_connection **connp, > } > } > > -static int client_setup(int reconnect) > +static struct udscs_connection *client_setup_sync(void) > { > + struct udscs_connection *conn = NULL; > + > while (!quit) { > - client = udscs_connect(vdagentd_socket, daemon_read_complete, NULL, > - vdagentd_messages, VDAGENTD_NO_MESSAGES, > - debug); > - if (client || !reconnect || quit) { > + conn = udscs_connect(vdagentd_socket, daemon_read_complete, NULL, > + vdagentd_messages, VDAGENTD_NO_MESSAGES, > + debug); > + if (conn || !do_daemonize || quit) { > break; > } > sleep(1); > } > - return client == NULL; > + return conn; > } > > static void quit_handler(int sig) > @@ -360,7 +362,8 @@ reconnect: > execvp(argv[0], argv); > } > > - if (client_setup(do_daemonize)) { > + client = client_setup_sync(); > + if (client == NULL) { > return 1; > } > _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel