cursor: Remove cursor_channel_disconnect()

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@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Christophe Fergeau 2017-08-30 10:28:45 +02:00
parent 54eb7716f0
commit becd0d30f6
3 changed files with 1 additions and 16 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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)