[Spice-devel] [PATCH spice-gtk] channel: reset c->has_error when connected
Marc-André Lureau
mlureau at redhat.com
Mon Apr 13 06:15:40 PDT 2015
Hi
----- Original Message -----
> Hey,
>
> On Mon, Apr 13, 2015 at 02:49:27PM +0200, Marc-André Lureau wrote:
> > Whenever the channel socket is connected, c->has_error should be reset.
> > Until now, only the regular open_host() case was reset, but client
> > client provided fd must also reset the error state.
>
> drop one 'client'
ok
>
> >
> > It should be safe to move it after the "connected" label, since the
> > ssl code doesn't need c->has_error.
>
>
> I tend to read that as "it's safe today", it sounds it would be safer to
> keep both? Or add c->has_error = FALSE explicitly in the fd case before
> the reconnect: label, and have g_warn_if_fail(!c->has_error); right
> after the connected label?
>
No, it should remain safe. c->has_error is really meant to be used after
the connection to spice server is established when it starts using
spice_channel_read/write*().
> Christophe
>
> >
> > https://bugzilla.redhat.com/show_bug.cgi?id=1211063
> > ---
> > gtk/spice-channel.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
> > index 95eb615..12d61ee 100644
> > --- a/gtk/spice-channel.c
> > +++ b/gtk/spice-channel.c
> > @@ -2331,8 +2331,6 @@ reconnect:
> > }
> > c->sock = g_object_ref(g_socket_connection_get_socket(c->conn));
> >
> > - c->has_error = FALSE;
> > -
> > if (c->tls) {
> > c->ctx = SSL_CTX_new(SSLv23_method());
> > if (c->ctx == NULL) {
> > @@ -2407,6 +2405,7 @@ ssl_reconnect:
> > }
> >
> > connected:
> > + c->has_error = FALSE;
> > c->in = g_io_stream_get_input_stream(G_IO_STREAM(c->conn));
> > c->out = g_io_stream_get_output_stream(G_IO_STREAM(c->conn));
> >
> > --
> > 2.1.0
> >
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
More information about the Spice-devel
mailing list