Re: [spice-gtk PATCH] spicy.c: Don't attempt to connect automatically if hostname and port are not provided

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

 



Thanks for your review.

2012/8/24 Marc-André Lureau <marcandre.lureau@xxxxxxxxx>:
> Hi,
>
> On Fri, Aug 24, 2012 at 11:48 AM,  <riegamaths@xxxxxxxxx> wrote:
>> From: Dunrong Huang <riegamaths@xxxxxxxxx>
>>
>> This patch will fix following error:
>> $ spicy --spice-debug
>> ......
>> (spicy:21981): GSpice-DEBUG: spice-session.c:1618 new main channel, switching
>> (spicy:21981): GSpice-DEBUG: spice-gtk-session.c:811 Changing main channel from (nil) to 0x8534b0
>> (spicy:21981): GSpice-DEBUG: spicy.c:1587 new channel (#0)
>> (spicy:21981): GSpice-DEBUG: spicy.c:1590 new main channel
>> (spicy:21981): GSpice-DEBUG: spice-channel.c:2255 Open coroutine starting 0x8534b0
>> (spicy:21981): GSpice-DEBUG: spice-channel.c:2098 Started background coroutine 0x853538 for main-1:0
>> (spicy:21981): GSpice-DEBUG: spice-channel.c:2122 connection failed, trying with TLS port
>> (spicy:21981): GSpice-DEBUG: spice-channel.c:2126 Connect error
>> GSpice-Message: main channel: failed to connect
>> ......
>>
>> When user starts spicy without any command-line arguments, spicy
>> should not attempt to connected to server automatically because
>> hostname or port are unknown at the moment.
>
>> What this patch changes is to show the dialog window instead of
>> connecting to server automatically if no hostname or port are found.
>>
>> Signed-off-by: Dunrong Huang <riegamaths@xxxxxxxxx>
>> ---
>>  gtk/spicy.c |   15 ++++++++++++++-
>>  1 files changed, 14 insertions(+), 1 deletions(-)
>>
>> diff --git a/gtk/spicy.c b/gtk/spicy.c
>> index 5510f0c..ce788e5 100644
>> --- a/gtk/spicy.c
>> +++ b/gtk/spicy.c
>> @@ -1804,6 +1804,7 @@ int main(int argc, char *argv[])
>>      GOptionContext *context;
>>      spice_connection *conn;
>>      gchar *conf_file, *conf;
>> +    char *host = NULL, *port = NULL, *tls_port = NULL;
>>
>>  #if !GLIB_CHECK_VERSION(2,31,18)
>>      g_thread_init(NULL);
>> @@ -1869,8 +1870,20 @@ int main(int argc, char *argv[])
>>      conn = connection_new();
>>      spice_set_session_option(conn->session);
>>      spice_cmdline_session_setup(conn->session);
>> -    connection_connect(conn);
>>
>> +    g_object_get(conn->session, "host", &host, NULL);
>> +    g_object_get(conn->session, "port", &port, NULL);
>> +    g_object_get(conn->session, "tls-port", &tls_port, NULL);
>
> Those variable will need to be free.
>
Thank you for pointing it out, I will fix it.
>> +    /* If user doesn't provide hostname and port, show the dialog window
>> +       instead of connecting to server automatically */
>> +    if (host == NULL || (port == NULL && tls_port == NULL)) {
>> +        int ret = connect_dialog(conn->session);
>> +        if (ret != 0) {
>> +            exit(0);
>> +        }
>> +    }
>> +    connection_connect(conn);
>>      if (connections > 0)
>>          g_main_loop_run(mainloop);
>>      g_main_loop_unref(mainloop);
>
> It looks good otherwise
>
v2 is comming soon.
> --
> Marc-André Lureau



-- 
Best Regards,

Dunrong Huang
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]