summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2014-02-27 19:38:41 +0200
committerFrediano Ziglio <fziglio@redhat.com>2015-10-15 18:30:34 +0100
commitc1d518139699081f87d15cdb8c027e5e2c14ff5c (patch)
treece644a9889a01cf1df9d9ef11df83b6ff49bb9be /server
parentc61404f102d2a6c5f0fb6e6f7d1c17911c91d053 (diff)
downloadspice-c1d518139699081f87d15cdb8c027e5e2c14ff5c.tar.gz
spice-c1d518139699081f87d15cdb8c027e5e2c14ff5c.tar.xz
spice-c1d518139699081f87d15cdb8c027e5e2c14ff5c.zip
server: small move to red_channel
Acked-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Diffstat (limited to 'server')
-rw-r--r--server/red_channel.c9
-rw-r--r--server/red_channel.h6
-rw-r--r--server/red_worker.c20
3 files changed, 18 insertions, 17 deletions
diff --git a/server/red_channel.c b/server/red_channel.c
index 3f40fab0..8db3d6ea 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 619a8417..1f1538ea 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 acca8949..f5cfa7c2 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);
}
}