server: Rename DISPLAY_CLIENT_TIMEOUT and de-duplicate it

Given that it is used for both cursor and display, COMMON_CLIENT_TIMEOUT
seems more appropriate. Also define it only in red-worker.h.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Francois Gouget 2015-12-14 10:52:43 +00:00 committed by Frediano Ziglio
parent 67f619d551
commit cbc4e07682
5 changed files with 8 additions and 9 deletions

View File

@ -549,7 +549,7 @@ void cursor_channel_reset(CursorChannel *cursor)
red_pipes_add_verb(channel, SPICE_MSG_CURSOR_RESET);
}
if (!red_channel_wait_all_sent(&cursor->common.base,
DISPLAY_CLIENT_TIMEOUT)) {
COMMON_CLIENT_TIMEOUT)) {
red_channel_apply_clients(channel,
red_channel_client_disconnect_if_pending_send);
}

View File

@ -123,7 +123,7 @@ int dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, int surface
if (item) {
return red_channel_client_wait_pipe_item_sent(RED_CHANNEL_CLIENT(dcc), item,
DISPLAY_CLIENT_TIMEOUT);
COMMON_CLIENT_TIMEOUT);
} else {
/*
* in case that the pipe didn't contain any item that is dependent on the surface, but
@ -415,7 +415,7 @@ static void dcc_create_all_streams(DisplayChannelClient *dcc)
static int display_channel_client_wait_for_init(DisplayChannelClient *dcc)
{
dcc->expect_init = TRUE;
uint64_t end_time = spice_get_monotonic_time_ns() + DISPLAY_CLIENT_TIMEOUT;
uint64_t end_time = spice_get_monotonic_time_ns() + COMMON_CLIENT_TIMEOUT;
for (;;) {
red_channel_client_receive(RED_CHANNEL_CLIENT(dcc));
if (!red_channel_client_is_connected(RED_CHANNEL_CLIENT(dcc))) {

View File

@ -31,7 +31,6 @@
#define PALETTE_CACHE_HASH_KEY(id) ((id) & PALETTE_CACHE_HASH_MASK)
#define CLIENT_PALETTE_CACHE_SIZE 128
#define DISPLAY_CLIENT_TIMEOUT 30000000000ULL //nano
#define DISPLAY_CLIENT_MIGRATE_DATA_TIMEOUT 10000000000ULL //nano, 10 sec
#define DISPLAY_CLIENT_RETRY_INTERVAL 10000 //micro

View File

@ -397,7 +397,7 @@ static void flush_display_commands(RedWorker *worker)
if (ring_is_empty) {
break;
}
end_time = spice_get_monotonic_time_ns() + DISPLAY_CLIENT_TIMEOUT;
end_time = spice_get_monotonic_time_ns() + COMMON_CLIENT_TIMEOUT;
int sleep_count = 0;
for (;;) {
red_channel_push(RED_CHANNEL(worker->display_channel));
@ -441,7 +441,7 @@ static void flush_cursor_commands(RedWorker *worker)
if (ring_is_empty) {
break;
}
end_time = spice_get_monotonic_time_ns() + DISPLAY_CLIENT_TIMEOUT;
end_time = spice_get_monotonic_time_ns() + COMMON_CLIENT_TIMEOUT;
int sleep_count = 0;
for (;;) {
red_channel_push(RED_CHANNEL(worker->cursor_channel));
@ -952,12 +952,12 @@ static void handle_dev_stop(void *opaque, void *payload)
* to the client (there is no such message right now), and start
* from scratch on the destination side */
if (!red_channel_wait_all_sent(RED_CHANNEL(worker->display_channel),
DISPLAY_CLIENT_TIMEOUT)) {
COMMON_CLIENT_TIMEOUT)) {
red_channel_apply_clients(RED_CHANNEL(worker->display_channel),
red_channel_client_disconnect_if_pending_send);
}
if (!red_channel_wait_all_sent(RED_CHANNEL(worker->cursor_channel),
DISPLAY_CLIENT_TIMEOUT)) {
COMMON_CLIENT_TIMEOUT)) {
red_channel_apply_clients(RED_CHANNEL(worker->cursor_channel),
red_channel_client_disconnect_if_pending_send);
}

View File

@ -33,7 +33,7 @@ typedef struct CommonChannelClient {
} CommonChannelClient;
#define COMMON_CHANNEL_CLIENT(Client) ((CommonChannelClient*)(Client))
#define DISPLAY_CLIENT_TIMEOUT 30000000000ULL //nano
#define COMMON_CLIENT_TIMEOUT 30000000000ULL //nano
#define CHANNEL_RECEIVE_BUF_SIZE 1024
typedef struct CommonChannel {