From: Marc-André Lureau <marcandre.lureau@xxxxxxxxx> --- server/red_channel.c | 9 +++++++++ server/red_channel.h | 6 ++++++ server/red_worker.c | 20 +++----------------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/server/red_channel.c b/server/red_channel.c index 3f40fab..8db3d6e 100644 --- a/server/red_channel.c +++ b/server/red_channel.c @@ -2429,3 +2429,12 @@ int red_channel_wait_all_sent(RedChannel *channel, return TRUE; } } + +void red_channel_client_disconnect_if_pending_send(RedChannelClient *rcc) +{ + if (red_channel_client_blocked(rcc) || rcc->pipe_size > 0) { + red_channel_client_disconnect(rcc); + } else { + spice_assert(red_channel_client_no_item_being_sent(rcc)); + } +} diff --git a/server/red_channel.h b/server/red_channel.h index 619a841..1f1538e 100644 --- a/server/red_channel.h +++ b/server/red_channel.h @@ -151,6 +151,11 @@ typedef struct PipeItem { int type; } PipeItem; +static inline int pipe_item_is_linked(PipeItem *item) +{ + return ring_item_is_linked(&item->link); +} + typedef uint8_t *(*channel_alloc_msg_recv_buf_proc)(RedChannelClient *channel, uint16_t type, uint32_t size); typedef int (*channel_handle_parsed_proc)(RedChannelClient *rcc, uint32_t size, uint16_t type, @@ -622,5 +627,6 @@ int red_channel_client_wait_outgoing_item(RedChannelClient *rcc, int64_t timeout); int red_channel_wait_all_sent(RedChannel *channel, int64_t timeout); +void red_channel_client_disconnect_if_pending_send(RedChannelClient *rcc); #endif diff --git a/server/red_worker.c b/server/red_worker.c index acca894..f5cfa7c 100644 --- a/server/red_worker.c +++ b/server/red_worker.c @@ -1398,11 +1398,6 @@ static void show_draw_item(RedWorker *worker, DrawItem *draw_item, const char *p draw_item->base.rgn.extents.y2); } -static inline int pipe_item_is_linked(PipeItem *item) -{ - return ring_item_is_linked(&item->link); -} - static void red_pipe_add_verb(RedChannelClient* rcc, uint16_t verb) { VerbItem *item = spice_new(VerbItem, 1); @@ -11133,15 +11128,6 @@ void handle_dev_destroy_surface_wait(void *opaque, void *payload) dev_destroy_surface_wait(worker, msg->surface_id); } -static void rcc_disconnect_if_pending_send(RedChannelClient *rcc) -{ - if (red_channel_client_blocked(rcc) || rcc->pipe_size > 0) { - red_channel_client_disconnect(rcc); - } else { - spice_assert(red_channel_client_no_item_being_sent(rcc)); - } -} - static inline void red_cursor_reset(RedWorker *worker) { if (worker->cursor) { @@ -11162,7 +11148,7 @@ static inline void red_cursor_reset(RedWorker *worker) if (!red_channel_wait_all_sent(&worker->cursor_channel->common.base, DISPLAY_CLIENT_TIMEOUT)) { red_channel_apply_clients(&worker->cursor_channel->common.base, - rcc_disconnect_if_pending_send); + red_channel_client_disconnect_if_pending_send); } } } @@ -11456,12 +11442,12 @@ void handle_dev_stop(void *opaque, void *payload) if (!red_channel_wait_all_sent(&worker->display_channel->common.base, DISPLAY_CLIENT_TIMEOUT)) { red_channel_apply_clients(&worker->display_channel->common.base, - rcc_disconnect_if_pending_send); + red_channel_client_disconnect_if_pending_send); } if (!red_channel_wait_all_sent(&worker->cursor_channel->common.base, DISPLAY_CLIENT_TIMEOUT)) { red_channel_apply_clients(&worker->cursor_channel->common.base, - rcc_disconnect_if_pending_send); + red_channel_client_disconnect_if_pending_send); } } -- 2.4.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel