diff options
-rw-r--r-- | server/reds.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/server/reds.c b/server/reds.c index 6a2aea28..43caea0d 100644 --- a/server/reds.c +++ b/server/reds.c @@ -1329,12 +1329,14 @@ static void reds_channel_init_auth_caps(RedLinkInfo *link, RedChannel *channel) red_channel_set_common_cap(channel, SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION); } +static const uint32_t *red_link_mess_get_caps(const SpiceLinkMess *mess) +{ + return (const uint32_t *)(mess + mess->caps_offset); +} static const uint32_t *red_link_info_get_caps(const RedLinkInfo *link) { - const uint8_t *caps_start = (const uint8_t *)link->link_mess; - - return (const uint32_t *)(caps_start + link->link_mess->caps_offset); + return red_link_mess_get_caps(link->link_mess); } static bool red_link_info_test_capability(const RedLinkInfo *link, uint32_t cap) @@ -1603,6 +1605,7 @@ static void reds_handle_main_link(RedLinkInfo *link) connection_id = link_mess->connection_id; mig_target = TRUE; } + caps = red_link_info_get_caps(link); reds->mig_inprogress = FALSE; reds->mig_wait_connect = FALSE; @@ -1614,7 +1617,6 @@ static void reds_handle_main_link(RedLinkInfo *link) link->stream = NULL; link->link_mess = NULL; reds_link_free(link); - caps = (uint32_t *)((uint8_t *)link_mess + link_mess->caps_offset); client = red_client_new(mig_target); ring_add(&reds->clients, &client->link); reds->num_clients++; @@ -1693,7 +1695,7 @@ static void reds_channel_do_link(RedChannel *channel, RedClient *client, spice_assert(link_msg); spice_assert(stream); - caps = (uint32_t *)((uint8_t *)link_msg + link_msg->caps_offset); + caps = red_link_mess_get_caps(link_msg); channel->client_cbs.connect(channel, client, stream, red_client_during_migrate_at_target(client), link_msg->num_common_caps, |