[Spice-devel] [PATCH 3/7] Cleanup definitions of disconnect methods

Alon Levy alevy at redhat.com
Fri Feb 17 00:54:50 PST 2012


On Thu, Feb 16, 2012 at 11:30:09PM -0600, Dan McGee wrote:
> We had multiple stub methods that simply called other disconnect
> methods, making my head hurt with the indirection. Call the right
> methods at the right time and rip out the stub methods; if they are
> truely needed later they can be added again.

Looks good to me.

> 
> Signed-off-by: Dan McGee <dpmcgee at gmail.com>
> ---
>  server/red_channel.c |    2 --
>  server/red_worker.c  |   26 +++++---------------------
>  2 files changed, 5 insertions(+), 23 deletions(-)
> 
> diff --git a/server/red_channel.c b/server/red_channel.c
> index ec02018..fe50d2f 100644
> --- a/server/red_channel.c
> +++ b/server/red_channel.c
> @@ -1200,8 +1200,6 @@ void red_channel_client_disconnect(RedChannelClient *rcc)
>      reds_stream_free(rcc->stream);
>      rcc->stream = NULL;
>      red_channel_remove_client(rcc);
> -    // TODO: not do it till destroyed?
> -//    red_channel_client_remove(rcc);
>      rcc->channel->channel_cbs.on_disconnect(rcc);
>  }
>  
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 7703363..3973f3e 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -8721,17 +8721,6 @@ void red_show_tree(RedWorker *worker)
>      }
>  }
>  
> -// TODO: move to red_channel
> -static void red_disconnect_channel(RedChannel *channel)
> -{
> -    red_channel_disconnect(channel);
> -}
> -
> -static void display_channel_client_disconnect(RedChannelClient *rcc)
> -{
> -    red_channel_client_disconnect(rcc);
> -}
> -
>  static void display_channel_client_on_disconnect(RedChannelClient *rcc)
>  {
>      DisplayChannel *display_channel;
> @@ -8775,7 +8764,7 @@ void red_disconnect_all_display_TODO_remove_me(RedChannel *channel)
>      if (!channel) {
>          return;
>      }
> -    red_channel_apply_clients(channel, display_channel_client_disconnect);
> +    red_channel_apply_clients(channel, red_channel_client_disconnect);
>  }
>  
>  static void red_migrate_display(RedWorker *worker, RedChannelClient *rcc)
> @@ -9132,7 +9121,7 @@ static int display_channel_client_wait_for_init(DisplayChannelClient *dcc)
>          }
>          if (red_now() > end_time) {
>              red_printf("timeout");
> -            display_channel_client_disconnect(&dcc->common.base);
> +            red_channel_client_disconnect(&dcc->common.base);
>              break;
>          }
>          usleep(DISPLAY_CLIENT_RETRY_INTERVAL);
> @@ -9944,11 +9933,6 @@ error:
>      red_channel_client_destroy(&dcc->common.base);
>  }
>  
> -static void cursor_channel_client_disconnect(RedChannelClient *rcc)
> -{
> -    red_channel_client_disconnect(rcc);
> -}
> -
>  static void cursor_channel_client_on_disconnect(RedChannelClient *rcc)
>  {
>      if (!rcc) {
> @@ -9968,7 +9952,7 @@ static void red_disconnect_cursor(RedChannel *channel)
>      ASSERT(channel == (RedChannel *)common->worker->cursor_channel);
>      common->worker->cursor_channel = NULL;
>      red_channel_apply_clients(channel, red_reset_cursor_cache);
> -    red_disconnect_channel(channel);
> +    red_channel_disconnect(channel);
>  }
>  
>  static void red_migrate_cursor(RedWorker *worker, RedChannelClient *rcc)
> @@ -10676,7 +10660,7 @@ void handle_dev_display_disconnect(void *opaque, void *payload)
>  
>      red_printf("disconnect display client");
>      ASSERT(rcc);
> -    display_channel_client_disconnect(rcc);
> +    red_channel_client_disconnect(rcc);
>  }
>  
>  void handle_dev_display_migrate(void *opaque, void *payload)
> @@ -10725,7 +10709,7 @@ void handle_dev_cursor_disconnect(void *opaque, void *payload)
>  
>      red_printf("disconnect cursor client");
>      ASSERT(rcc);
> -    cursor_channel_client_disconnect(rcc);
> +    red_channel_client_disconnect(rcc);
>  }
>  
>  void handle_dev_cursor_migrate(void *opaque, void *payload)
> -- 
> 1.7.9.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list