[Spice-devel] [spice-server v2 3/5] Don't modify watch when network queue is full

Frediano Ziglio fziglio at redhat.com
Fri Apr 28 11:46:53 UTC 2017


> 
> Since 5c460d, we need to watch for WATCH_EVENT_WRITE as long as there are
> items queued waiting to be sent, this should not be done only when the
> network queue is full.
> 
> red_channel_client_set_blocked()/red_channel_client_msg_sent() are
> still adding/removing WATCH_EVENT_WRITE when the channel becomes
> blocked/unblocked. This should not be causing issues as if there is
> already pending data, we will send it without needing WATCH_EVENT_WRITE,
> and if it starts blocking, the write watch will be reenabled.
> 

I don't know why but I feel the above sentence is really confusing.
red_channel_client_set_blocked add the WRITE, in this case can be removed
as WRITE is already set.
red_channel_client_msg_sent removes the WRITE but this is also done
later after sending data so is redundant.

> However, it's at best redundant, so we can remove this.
> 
> Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
> ---
>  server/red-channel-client.c | 9 ---------
>  1 file changed, 9 deletions(-)
> 
> diff --git a/server/red-channel-client.c b/server/red-channel-client.c
> index 1c4b27df0..0d6077a5b 100644
> --- a/server/red-channel-client.c
> +++ b/server/red-channel-client.c
> @@ -495,13 +495,7 @@ static int
> red_channel_client_prepare_out_msg(RedChannelClient *rcc,
>  
>  static void red_channel_client_set_blocked(RedChannelClient *rcc)
>  {
> -    SpiceCoreInterfaceInternal *core;
> -
>      rcc->priv->send_data.blocked = TRUE;
> -    core = red_channel_get_core_interface(rcc->priv->channel);
> -    core->watch_update_mask(core, rcc->priv->stream->watch,
> -                            SPICE_WATCH_EVENT_READ |
> -                            SPICE_WATCH_EVENT_WRITE);
>  }
>  
>  static inline int
>  red_channel_client_urgent_marshaller_is_active(RedChannelClient *rcc)
> @@ -641,10 +635,7 @@ static void red_channel_client_msg_sent(RedChannelClient
> *rcc)
>  
>      red_channel_client_clear_sent_item(rcc);
>      if (red_channel_client_is_blocked(rcc)) {
> -        SpiceCoreInterfaceInternal *core =
> red_channel_get_core_interface(rcc->priv->channel);
>          rcc->priv->send_data.blocked = FALSE;
> -        core->watch_update_mask(core, rcc->priv->stream->watch,
> -                                SPICE_WATCH_EVENT_READ);
>      }
>  
>      if (red_channel_client_urgent_marshaller_is_active(rcc)) {

Frediano


More information about the Spice-devel mailing list