diff options
author | Yonit Halperin <yhalperi@redhat.com> | 2013-09-11 13:31:21 -0400 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2014-02-13 17:38:03 +0100 |
commit | 102aa15abcf5e7eb6e50bf52c5f0634f901090df (patch) | |
tree | f47489b44225c18dd80ba306fbfa56a014577ebe | |
parent | 5e60575292650a3816d6ba22cf4b272331969c11 (diff) |
red_channel: cleanup of red_channel_client blocking methodsreplay
(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 49aaa10e..10f295e7 100644 --- a/server/red_channel.c +++ b/server/red_channel.c @@ -2363,7 +2363,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; } } @@ -2392,8 +2392,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); @@ -2451,4 +2451,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 87ce7f6c..fa05b047 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); } } |