cursor_channel_disconnect() calls cursor_channel_client_reset_cursor_cache() on all CursorChannelClient associated with the current CursorChannel before calling red_channel_disconnect(). red_channel_disconnect() will iterate over all CursorChannelClient calling red_channel_client_disconnect(), which will eventually call CursorChannelClient::on_disconnect. This will in turn cursor_channel_client_reset_cursor_cache(), so calling it in cursor_channel_disconnect() before calling red_channel_disconnect() is redundant. cursor_channel_disconnect() can thus be replaced by a direct call to red_channel_disconnect(). Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> --- server/cursor-channel.c | 11 ----------- server/cursor-channel.h | 4 ---- server/red-worker.c | 2 +- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/server/cursor-channel.c b/server/cursor-channel.c index f35c9b209..8ac5af473 100644 --- a/server/cursor-channel.c +++ b/server/cursor-channel.c @@ -158,17 +158,6 @@ static void cursor_fill(CursorChannelClient *ccc, CursorItem *cursor, } } -void cursor_channel_disconnect(CursorChannel *cursor_channel) -{ - RedChannel *channel = RED_CHANNEL(cursor_channel); - - if (!channel || !red_channel_is_connected(channel)) { - return; - } - red_channel_apply_clients(channel, cursor_channel_client_reset_cursor_cache); - red_channel_disconnect(channel); -} - static void cursor_pipe_item_free(RedPipeItem *base) { spice_return_if_fail(base); diff --git a/server/cursor-channel.h b/server/cursor-channel.h index 9f3ef52e8..f279aafcf 100644 --- a/server/cursor-channel.h +++ b/server/cursor-channel.h @@ -59,10 +59,6 @@ GType cursor_channel_get_type(void) G_GNUC_CONST; CursorChannel* cursor_channel_new (RedsState *server, QXLInstance *qxl, const SpiceCoreInterfaceInternal *core); -/** - * Cause the channel to disconnect all clients - */ -void cursor_channel_disconnect (CursorChannel *cursor); void cursor_channel_reset (CursorChannel *cursor); void cursor_channel_do_init (CursorChannel *cursor); void cursor_channel_process_cmd (CursorChannel *cursor, RedCursorCmd *cursor_cmd); diff --git a/server/red-worker.c b/server/red-worker.c index 0e2e8fa3a..109db63e0 100644 --- a/server/red-worker.c +++ b/server/red-worker.c @@ -363,7 +363,7 @@ static void flush_display_commands(RedWorker *worker) static void red_disconnect_cursor(RedWorker *worker) { spice_warning("flush cursor timeout"); - cursor_channel_disconnect(worker->cursor_channel); + red_channel_disconnect(RED_CHANNEL(worker->cursor_channel)); } static void flush_cursor_commands(RedWorker *worker) -- 2.13.5 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel