[Spice-devel] [PATCH spice-gtk 1/2] spice-channel: Remove useless peer_pos
Christophe Fergeau
cfergeau at redhat.com
Tue Nov 20 16:44:30 UTC 2018
On Tue, Nov 20, 2018 at 01:25:44PM +0000, Frediano Ziglio wrote:
> With coroutine the spice_channel_recv_link_msg function reads the
> entire message, no reason to store partial position.
This reverts 9a36e853d which predates coroutines indeed.
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> 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 at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20181120/00c045ff/attachment.sig>
More information about the Spice-devel
mailing list