mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-30 09:46:50 +00:00
red-channel-client: Move handle_migrate_data_get_serial as a virtual function
Virtual functions cannot be null so use a return value instead and return the serial using a reference. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
d5ea93d3a8
commit
cf51158811
@ -53,6 +53,7 @@ protected:
|
||||
virtual bool handle_migrate_data(uint32_t size, void *message) override;
|
||||
virtual void migrate() override;
|
||||
virtual void handle_migrate_flush_mark() override;
|
||||
virtual bool handle_migrate_data_get_serial(uint32_t size, void *message, uint64_t &serial) override;
|
||||
|
||||
public:
|
||||
red::unique_link<DisplayChannelClientPrivate> priv;
|
||||
|
||||
@ -2211,13 +2211,15 @@ void DisplayChannelClient::handle_migrate_flush_mark()
|
||||
channel->pipes_add_type(RED_PIPE_ITEM_TYPE_MIGRATE_DATA);
|
||||
}
|
||||
|
||||
static uint64_t handle_migrate_data_get_serial(RedChannelClient *rcc, uint32_t size, void *message)
|
||||
bool DisplayChannelClient::handle_migrate_data_get_serial(uint32_t size, void *message,
|
||||
uint64_t &serial)
|
||||
{
|
||||
SpiceMigrateDataDisplay *migrate_data;
|
||||
|
||||
migrate_data = (SpiceMigrateDataDisplay *)((uint8_t *)message + sizeof(SpiceMigrateDataHeader));
|
||||
|
||||
return migrate_data->message_serial;
|
||||
serial = migrate_data->message_serial;
|
||||
return true;
|
||||
}
|
||||
|
||||
static SpiceCanvas *image_surfaces_get(SpiceImageSurfaces *surfaces, uint32_t surface_id)
|
||||
@ -2499,8 +2501,6 @@ display_channel_class_init(DisplayChannelClass *klass)
|
||||
|
||||
channel_class->parser = spice_get_client_channel_parser(SPICE_CHANNEL_DISPLAY, NULL);
|
||||
|
||||
channel_class->handle_migrate_data_get_serial = handle_migrate_data_get_serial;
|
||||
|
||||
// client callbacks
|
||||
channel_class->connect = display_channel_connect;
|
||||
|
||||
|
||||
@ -1271,7 +1271,6 @@ void RedChannelClient::handle_migrate_flush_mark()
|
||||
void RedChannelClient::handle_migrate_data_early(uint32_t size, void *message)
|
||||
{
|
||||
RedChannel *channel = get_channel();
|
||||
RedChannelClass *klass = RED_CHANNEL_GET_CLASS(channel);
|
||||
|
||||
red_channel_debug(channel, "rcc %p size %u", this, size);
|
||||
|
||||
@ -1284,8 +1283,9 @@ void RedChannelClient::handle_migrate_data_early(uint32_t size, void *message)
|
||||
spice_channel_client_error(this, "unexpected");
|
||||
return;
|
||||
}
|
||||
if (klass->handle_migrate_data_get_serial) {
|
||||
priv->set_message_serial(klass->handle_migrate_data_get_serial(this, size, message));
|
||||
uint64_t serial;
|
||||
if (handle_migrate_data_get_serial(size, message, serial)) {
|
||||
priv->set_message_serial(serial);
|
||||
}
|
||||
if (!handle_migrate_data(size, message)) {
|
||||
spice_channel_client_error(this, "handle_migrate_data failed");
|
||||
|
||||
@ -169,6 +169,10 @@ public:
|
||||
virtual void send_item(RedPipeItem *item) {};
|
||||
|
||||
virtual bool handle_migrate_data(uint32_t size, void *message) { return false; }
|
||||
virtual bool handle_migrate_data_get_serial(uint32_t size, void *message, uint64_t &serial)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Private functions */
|
||||
private:
|
||||
|
||||
@ -44,10 +44,6 @@ struct RedChannelClient;
|
||||
struct RedClient;
|
||||
struct MainChannelClient;
|
||||
|
||||
typedef uint64_t (*channel_handle_migrate_data_get_serial_proc)(RedChannelClient *base,
|
||||
uint32_t size, void *message);
|
||||
|
||||
|
||||
typedef void (*channel_client_connect_proc)(RedChannel *channel, RedClient *client, RedStream *stream,
|
||||
int migration, RedChannelCapabilities *caps);
|
||||
|
||||
@ -70,8 +66,6 @@ struct RedChannelClass
|
||||
*/
|
||||
spice_parse_channel_func_t parser;
|
||||
|
||||
channel_handle_migrate_data_get_serial_proc handle_migrate_data_get_serial;
|
||||
|
||||
/*
|
||||
* callbacks that are triggered from client events.
|
||||
* They should be called from the thread that handles the RedClient
|
||||
|
||||
Loading…
Reference in New Issue
Block a user