red-channel: Make parser function compulsory

As base messages require parsing better channels should always use
the generated parser.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
This commit is contained in:
Frediano Ziglio 2019-10-05 21:36:36 +01:00
parent bae2d1f00f
commit 774d466cf8
3 changed files with 6 additions and 11 deletions

View File

@ -1175,18 +1175,9 @@ static uint8_t *red_channel_client_parse(RedChannelClient *rcc, uint8_t *message
{
RedChannel *channel = red_channel_client_get_channel(rcc);
RedChannelClass *klass = RED_CHANNEL_GET_CLASS(channel);
uint8_t *parsed_message;
if (klass->parser) {
parsed_message = klass->parser(message, message + message_size, message_type,
SPICE_VERSION_MINOR, size_out, free_message);
} else {
parsed_message = message;
*size_out = message_size;
*free_message = NULL;
}
return parsed_message;
return klass->parser(message, message + message_size, message_type,
SPICE_VERSION_MINOR, size_out, free_message);
}
// TODO: this implementation, as opposed to the old implementation in red_worker,

View File

@ -208,6 +208,7 @@ red_channel_constructed(GObject *object)
G_OBJECT_CLASS(red_channel_parent_class)->constructed(object);
spice_assert(klass->parser != NULL);
spice_assert(klass->handle_migrate_data ||
!(self->priv->migration_flags & SPICE_MIGRATE_NEED_DATA_TRANSFER));
}

View File

@ -197,6 +197,9 @@ stream_channel_init(StreamChannel *channel)
static void
stream_channel_class_init(StreamChannelClass *klass)
{
RedChannelClass *channel_class = RED_CHANNEL_CLASS(klass);
channel_class->parser = spice_get_client_channel_parser(SPICE_CHANNEL_DISPLAY, NULL);
}
void stream_channel_change_format(StreamChannel *channel,