With coroutine the spice_channel_recv_link_msg function reads the entire message, no reason to store partial position. Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- src/spice-channel-priv.h | 1 - src/spice-channel.c | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/spice-channel-priv.h b/src/spice-channel-priv.h index 091c1163..5984ca56 100644 --- a/src/spice-channel-priv.h +++ b/src/spice-channel-priv.h @@ -129,7 +129,6 @@ struct _SpiceChannelPrivate { SpiceLinkHeader link_hdr; SpiceLinkHeader peer_hdr; SpiceLinkReply* peer_msg; - int peer_pos; int message_ack_window; int message_ack_count; diff --git a/src/spice-channel.c b/src/spice-channel.c index 2aa0826d..dc3e2950 100644 --- a/src/spice-channel.c +++ b/src/spice-channel.c @@ -1906,10 +1906,8 @@ static gboolean spice_channel_recv_link_msg(SpiceChannel *channel) c = channel->priv; - rc = spice_channel_read(channel, (uint8_t*)c->peer_msg + c->peer_pos, - c->peer_hdr.size - c->peer_pos); - c->peer_pos += rc; - if (c->peer_pos != c->peer_hdr.size) { + rc = spice_channel_read(channel, (uint8_t*)c->peer_msg, c->peer_hdr.size); + if (rc != c->peer_hdr.size) { g_critical("%s: %s: incomplete link reply (%d/%u)", c->name, __FUNCTION__, rc, c->peer_hdr.size); goto error; @@ -2821,7 +2819,6 @@ static void channel_reset(SpiceChannel *channel, gboolean migrating) c->auth_needs_password = FALSE; g_clear_pointer(&c->peer_msg, g_free); - c->peer_pos = 0; g_mutex_lock(&c->xmit_queue_lock); c->xmit_queue_blocked = TRUE; /* Disallow queuing new messages */ -- 2.17.2 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel