[Spice-devel] [spice-gtk] Keep GSocketConnection around after initial connect

Christophe Fergeau cfergeau at redhat.com
Wed Mar 27 08:08:52 PDT 2013


On Wed, Mar 27, 2013 at 03:59:26PM +0100, Marc-André Lureau wrote:
> On Wed, Mar 27, 2013 at 3:53 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> > +    if (c->conn) {
> > +        g_object_unref(c->conn);
> > +        c->sock = NULL;
> > +        c->conn = NULL;
> > +    }
> >      if (c->sock) {
> >          g_object_unref(c->sock);
> >          c->sock = NULL;
> 
> Can we remove the if (c->sock) block below?

I've kept it because of the
if (spice_session_get_client_provided_socket(c->session)) {
        if (!(c->sock = g_socket_new_from_fd(c->fd, NULL))) {
                CHANNEL_DEBUG(channel, "Failed to open socket from fd %d",
c->fd);
                emit_main_context(channel, SPICE_CHANNEL_EVENT,
SPICE_CHANNEL_ERROR_CONNECT);
                goto cleanup;
        }

        g_socket_set_blocking(c->sock, FALSE);
        g_socket_set_keepalive(c->sock, TRUE);
        goto connected;
    }
}
codepath in spice_channel_coroutine().

I can indeed add a g_object_ref() where g_socket_connection_get_socket() is
called and remove the c->sock = NULL; bit from if (c->conn){}

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130327/77b4e3f3/attachment.pgp>


More information about the Spice-devel mailing list