> > 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@xxxxxxxxxxxxxxx> > --- > server/cursor-channel.c | 2 +- > server/dcc.c | 4 ++-- > server/dcc.h | 1 - > server/red-worker.c | 8 ++++---- > server/red-worker.h | 2 +- > 5 files changed, 8 insertions(+), 9 deletions(-) > > See: > http://lists.freedesktop.org/archives/spice-devel/2015-December/024908.html > > diff --git a/server/cursor-channel.c b/server/cursor-channel.c > index 840ff30..ec994e3 100644 > --- a/server/cursor-channel.c > +++ b/server/cursor-channel.c > @@ -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); > } > diff --git a/server/dcc.c b/server/dcc.c > index f47cbec..b2ee7a6 100644 > --- a/server/dcc.c > +++ b/server/dcc.c > @@ -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))) { > diff --git a/server/dcc.h b/server/dcc.h > index 4401384..2a12226 100644 > --- a/server/dcc.h > +++ b/server/dcc.h > @@ -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 (NSEC_PER_SEC * 30) > #define DISPLAY_CLIENT_MIGRATE_DATA_TIMEOUT (NSEC_PER_SEC * 10) > #define DISPLAY_CLIENT_RETRY_INTERVAL 10000 //micro > > diff --git a/server/red-worker.c b/server/red-worker.c > index 5771442..dfaf4ba 100644 > --- a/server/red-worker.c > +++ b/server/red-worker.c > @@ -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); > } > diff --git a/server/red-worker.h b/server/red-worker.h > index e6e3404..1f0cd99 100644 > --- a/server/red-worker.h > +++ b/server/red-worker.h > @@ -33,7 +33,7 @@ typedef struct CommonChannelClient { > } CommonChannelClient; > > #define COMMON_CHANNEL_CLIENT(Client) ((CommonChannelClient*)(Client)) > -#define DISPLAY_CLIENT_TIMEOUT (NSEC_PER_SEC * 30) > +#define COMMON_CLIENT_TIMEOUT (NSEC_PER_SEC * 30) > > #define CHANNEL_RECEIVE_BUF_SIZE 1024 > typedef struct CommonChannel { Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx> Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel