mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-11 08:07:16 +00:00
worker: move display_channel_wait_for_migrate_data
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
parent
0e224d04fb
commit
1cbf6b3ab6
@ -807,3 +807,34 @@ int display_channel_add_drawable(DisplayChannel *display, Drawable *drawable)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int display_channel_wait_for_migrate_data(DisplayChannel *display)
|
||||
{
|
||||
uint64_t end_time = red_get_monotonic_time() + DISPLAY_CLIENT_MIGRATE_DATA_TIMEOUT;
|
||||
RedChannel *channel = &display->common.base;
|
||||
RedChannelClient *rcc;
|
||||
|
||||
spice_debug(NULL);
|
||||
spice_assert(channel->clients_num == 1);
|
||||
|
||||
rcc = SPICE_CONTAINEROF(ring_get_head(&channel->clients), RedChannelClient, channel_link);
|
||||
spice_assert(red_channel_client_waits_for_migrate_data(rcc));
|
||||
|
||||
for (;;) {
|
||||
red_channel_client_receive(rcc);
|
||||
if (!red_channel_client_is_connected(rcc)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!red_channel_client_waits_for_migrate_data(rcc)) {
|
||||
return TRUE;
|
||||
}
|
||||
if (red_get_monotonic_time() > end_time) {
|
||||
spice_warning("timeout");
|
||||
red_channel_client_disconnect(rcc);
|
||||
break;
|
||||
}
|
||||
usleep(DISPLAY_CLIENT_RETRY_INTERVAL);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -268,6 +268,7 @@ int display_channel_add_drawable (DisplayCha
|
||||
Drawable *drawable);
|
||||
void display_channel_current_flush (DisplayChannel *display,
|
||||
int surface_id);
|
||||
int display_channel_wait_for_migrate_data (DisplayChannel *display);
|
||||
|
||||
static inline int is_equal_path(SpicePath *path1, SpicePath *path2)
|
||||
{
|
||||
|
||||
@ -6911,37 +6911,6 @@ static void handle_dev_stop(void *opaque, void *payload)
|
||||
}
|
||||
}
|
||||
|
||||
static int display_channel_wait_for_migrate_data(DisplayChannel *display)
|
||||
{
|
||||
uint64_t end_time = red_get_monotonic_time() + DISPLAY_CLIENT_MIGRATE_DATA_TIMEOUT;
|
||||
RedChannel *channel = &display->common.base;
|
||||
RedChannelClient *rcc;
|
||||
|
||||
spice_debug(NULL);
|
||||
spice_assert(channel->clients_num == 1);
|
||||
|
||||
rcc = SPICE_CONTAINEROF(ring_get_head(&channel->clients), RedChannelClient, channel_link);
|
||||
spice_assert(red_channel_client_waits_for_migrate_data(rcc));
|
||||
|
||||
for (;;) {
|
||||
red_channel_client_receive(rcc);
|
||||
if (!red_channel_client_is_connected(rcc)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!red_channel_client_waits_for_migrate_data(rcc)) {
|
||||
return TRUE;
|
||||
}
|
||||
if (red_get_monotonic_time() > end_time) {
|
||||
spice_warning("timeout");
|
||||
red_channel_client_disconnect(rcc);
|
||||
break;
|
||||
}
|
||||
usleep(DISPLAY_CLIENT_RETRY_INTERVAL);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void handle_dev_start(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user