diff options
author | Yonit Halperin <yhalperi@redhat.com> | 2013-09-11 13:31:21 -0400 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2013-11-20 15:07:37 +0200 |
commit | 0879f5e174596a643bda55276a5ab99e6be66380 (patch) | |
tree | e03a06426ab6dcb84eeecfbefad2943edac42a53 | |
parent | 0d82af5eee97d8a54e2de592155235dfe95555a5 (diff) |
red_channel: cleanup of red_channel_client blocking methodswip/replay
(1) receive timeout as a parameter.
(2) add a return value and pass the handling
of failures to the calling routine.
-rw-r--r-- | server/cursor-channel.c | 1 | ||||
-rw-r--r-- | server/dcc.h | 1 | ||||
-rw-r--r-- | server/red_channel.c | 8 | ||||
-rw-r--r-- | server/red_worker.c | 4 |
4 files changed, 9 insertions, 5 deletions
diff --git a/server/cursor-channel.c b/server/cursor-channel.c index 20e7351a..421b1e2a 100644 --- a/server/cursor-channel.c +++ b/server/cursor-channel.c @@ -7,6 +7,7 @@ #define CURSOR_CACHE_HASH_SIZE (1 << CURSOR_CACHE_HASH_SHIFT) #define CURSOR_CACHE_HASH_MASK (CURSOR_CACHE_HASH_SIZE - 1) #define CURSOR_CACHE_HASH_KEY(id) ((id) & CURSOR_CACHE_HASH_MASK) +#define CURSOR_CLIENT_TIMEOUT 30000000000ULL //nano enum { PIPE_ITEM_TYPE_CURSOR = PIPE_ITEM_TYPE_COMMON_LAST, diff --git a/server/dcc.h b/server/dcc.h index 9c5ebe5e..40438235 100644 --- a/server/dcc.h +++ b/server/dcc.h @@ -13,6 +13,7 @@ #define PALETTE_CACHE_HASH_KEY(id) ((id) & PALETTE_CACHE_HASH_MASK) #define CLIENT_PALETTE_CACHE_SIZE 128 +#define DISPLAY_CLIENT_SHORT_TIMEOUT 15000000000ULL //nano #define DISPLAY_CLIENT_TIMEOUT 30000000000ULL //nano #define DISPLAY_CLIENT_MIGRATE_DATA_TIMEOUT 10000000000ULL //nano, 10 sec #define DISPLAY_CLIENT_RETRY_INTERVAL 10000 //micro diff --git a/server/red_channel.c b/server/red_channel.c index 05d1d8f1..cf3f661a 100644 --- a/server/red_channel.c +++ b/server/red_channel.c @@ -2362,7 +2362,7 @@ int red_channel_client_wait_outgoing_item(RedChannelClient *rcc, spice_warning("timeout"); return FALSE; } else { - spice_assert(red_channel_client_no_item_being_sent(rcc)); + spice_warn_if_fail(red_channel_client_no_item_being_sent(rcc)); return TRUE; } } @@ -2391,8 +2391,8 @@ int red_channel_client_wait_pipe_item_sent(RedChannelClient *rcc, } red_channel_client_push(rcc); - while((item_in_pipe = ring_item_is_linked(&item->link)) && - (timeout == -1 || red_get_monotonic_time() < end_time)) { + while ((item_in_pipe = ring_item_is_linked(&item->link)) && + (timeout == -1 || red_get_monotonic_time() < end_time)) { usleep(CHANNEL_BLOCKED_SLEEP_DURATION); red_channel_client_receive(rcc); red_channel_client_send(rcc); @@ -2450,4 +2450,6 @@ void red_channel_client_disconnect_if_pending_send(RedChannelClient *rcc) } else { spice_assert(red_channel_client_no_item_being_sent(rcc)); } + + spice_warn_if_fail(red_channel_client_no_item_being_sent(rcc)); } diff --git a/server/red_worker.c b/server/red_worker.c index 1576b0ea..a868265a 100644 --- a/server/red_worker.c +++ b/server/red_worker.c @@ -1023,12 +1023,12 @@ static void handle_dev_stop(void *opaque, uint32_t message_type, void *payload) if (!red_channel_wait_all_sent(RED_CHANNEL(worker->display_channel), DISPLAY_CLIENT_TIMEOUT)) { red_channel_apply_clients(RED_CHANNEL(worker->display_channel), - red_channel_client_disconnect_if_pending_send); + red_channel_client_disconnect_if_pending_send); } if (!red_channel_wait_all_sent(RED_CHANNEL(worker->cursor_channel), DISPLAY_CLIENT_TIMEOUT)) { red_channel_apply_clients(RED_CHANNEL(worker->cursor_channel), - red_channel_client_disconnect_if_pending_send); + red_channel_client_disconnect_if_pending_send); } } |