mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-12 19:18:11 +00:00
red-channel-client: Move incoming/ougoing initialization to constructor
These fields need just channel to be set to be initialized. Move their initialization to constructor to make sure they are initialized as soon as possible. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
parent
f5c0e555d3
commit
bac3a682c8
@ -70,8 +70,6 @@ static gboolean dummy_channel_client_initable_init(GInitable *initable,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rcc->incoming.header.data = rcc->incoming.header_buf;
|
||||
|
||||
red_channel_add_client(channel, rcc);
|
||||
red_client_add_channel(client, rcc);
|
||||
|
||||
|
||||
@ -269,6 +269,14 @@ static void red_channel_client_constructed(GObject *object)
|
||||
{
|
||||
RedChannelClient *self = RED_CHANNEL_CLIENT(object);
|
||||
|
||||
self->incoming.opaque = self;
|
||||
self->incoming.cb = red_channel_get_incoming_handler(self->priv->channel);
|
||||
|
||||
self->priv->outgoing.opaque = self;
|
||||
self->priv->outgoing.cb = red_channel_get_outgoing_handler(self->priv->channel);
|
||||
self->priv->outgoing.pos = 0;
|
||||
self->priv->outgoing.size = 0;
|
||||
|
||||
if (red_channel_client_test_remote_common_cap(self, SPICE_COMMON_CAP_MINI_HEADER)) {
|
||||
self->incoming.header = mini_header_wrapper;
|
||||
self->priv->send_data.header = mini_header_wrapper;
|
||||
@ -278,6 +286,7 @@ static void red_channel_client_constructed(GObject *object)
|
||||
self->priv->send_data.header = full_header_wrapper;
|
||||
self->priv->is_mini_header = FALSE;
|
||||
}
|
||||
self->incoming.header.data = self->incoming.header_buf;
|
||||
}
|
||||
|
||||
static void red_channel_client_class_init(RedChannelClientClass *klass)
|
||||
@ -900,15 +909,6 @@ static gboolean red_channel_client_initable_init(GInitable *initable,
|
||||
self->priv->latency_monitor.roundtrip = -1;
|
||||
}
|
||||
|
||||
self->incoming.opaque = self;
|
||||
self->incoming.cb = red_channel_get_incoming_handler(self->priv->channel);
|
||||
self->incoming.header.data = self->incoming.header_buf;
|
||||
|
||||
self->priv->outgoing.opaque = self;
|
||||
self->priv->outgoing.cb = red_channel_get_outgoing_handler(self->priv->channel);
|
||||
self->priv->outgoing.pos = 0;
|
||||
self->priv->outgoing.size = 0;
|
||||
|
||||
if (self->priv->stream)
|
||||
self->priv->stream->watch =
|
||||
core->watch_add(core, self->priv->stream->socket,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user