Use RED_CHANNEL_CLIENT() macro for casting

Also remove (main|inputs)_channel_client_get_base() function to prepare
for porting to GObject.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Jonathon Jongsma 2016-09-07 15:37:28 -05:00 committed by Frediano Ziglio
parent f9c4f6da0e
commit 8f1f60d46f
8 changed files with 74 additions and 72 deletions

View File

@ -78,7 +78,7 @@ static void FUNC_NAME(remove)(CHANNELCLIENT *channel_client, RedCacheItem *item)
channel_client->priv->VAR_NAME(available) += item->u.cache_data.size;
red_pipe_item_init(&item->u.pipe_data, RED_PIPE_ITEM_TYPE_INVAL_ONE);
red_channel_client_pipe_add_tail_and_push(&channel_client->base, &item->u.pipe_data); // for now
red_channel_client_pipe_add_tail_and_push(RED_CHANNEL_CLIENT(channel_client), &item->u.pipe_data); // for now
}
static int FUNC_NAME(add)(CHANNELCLIENT *channel_client, uint64_t id, size_t size)

View File

@ -546,15 +546,15 @@ void dcc_push_monitors_config(DisplayChannelClient *dcc)
return;
}
if (!red_channel_client_test_remote_cap(&dcc->base,
if (!red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(dcc),
SPICE_DISPLAY_CAP_MONITORS_CONFIG)) {
return;
}
mci = red_monitors_config_item_new(red_channel_client_get_channel(&dcc->base),
mci = red_monitors_config_item_new(red_channel_client_get_channel(RED_CHANNEL_CLIENT(dcc)),
monitors_config_ref(dc->monitors_config));
red_channel_client_pipe_add(&dcc->base, &mci->pipe_item);
red_channel_client_push(&dcc->base);
red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &mci->pipe_item);
red_channel_client_push(RED_CHANNEL_CLIENT(dcc));
}
static RedSurfaceDestroyItem *red_surface_destroy_item_new(RedChannel *channel,
@ -749,7 +749,7 @@ int dcc_compress_image(DisplayChannelClient *dcc,
goto lz_compress;
#ifdef USE_LZ4
case SPICE_IMAGE_COMPRESSION_LZ4:
if (red_channel_client_test_remote_cap(&dcc->base,
if (red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(dcc),
SPICE_DISPLAY_CAP_LZ4_COMPRESSION)) {
success = image_encoders_compress_lz4(&dcc->priv->encoders, dest, src, o_comp_data);
break;

View File

@ -56,7 +56,7 @@ RedChannelClient* inputs_channel_client_create(RedChannel *channel,
if (icc) {
icc->priv->motion_count = 0;
}
return &icc->base;
return RED_CHANNEL_CLIENT(icc);
}
void inputs_channel_client_send_migrate_data(RedChannelClient *rcc,
@ -79,17 +79,19 @@ void inputs_channel_client_handle_migrate_data(InputsChannelClient *icc,
for (; icc->priv->motion_count >= SPICE_INPUT_MOTION_ACK_BUNCH;
icc->priv->motion_count -= SPICE_INPUT_MOTION_ACK_BUNCH) {
red_channel_client_pipe_add_type(&icc->base, RED_PIPE_ITEM_MOUSE_MOTION_ACK);
red_channel_client_pipe_add_type(RED_CHANNEL_CLIENT(icc),
RED_PIPE_ITEM_MOUSE_MOTION_ACK);
}
}
void inputs_channel_client_on_mouse_motion(InputsChannelClient *icc)
{
InputsChannel *inputs_channel = (InputsChannel *)red_channel_client_get_channel(&icc->base);
InputsChannel *inputs_channel = (InputsChannel *)red_channel_client_get_channel(RED_CHANNEL_CLIENT(icc));
if (++icc->priv->motion_count % SPICE_INPUT_MOTION_ACK_BUNCH == 0 &&
!inputs_channel_is_src_during_migrate(inputs_channel)) {
red_channel_client_pipe_add_type(&icc->base, RED_PIPE_ITEM_MOUSE_MOTION_ACK);
red_channel_client_pipe_add_type(RED_CHANNEL_CLIENT(icc),
RED_PIPE_ITEM_MOUSE_MOTION_ACK);
icc->priv->motion_count = 0;
}
}

View File

@ -152,7 +152,8 @@ void main_channel_client_start_net_test(MainChannelClient *mcc, int test_rate)
}
if (!test_rate) {
red_channel_client_start_connectivity_monitoring(&mcc->base, CLIENT_CONNECTIVITY_TIMEOUT);
red_channel_client_start_connectivity_monitoring(RED_CHANNEL_CLIENT(mcc),
CLIENT_CONNECTIVITY_TIMEOUT);
return;
}
@ -181,7 +182,7 @@ static int main_channel_client_push_ping(MainChannelClient *mcc, int size)
return FALSE;
}
item = red_ping_item_new(size);
red_channel_client_pipe_add_push(&mcc->base, item);
red_channel_client_pipe_add_push(RED_CHANNEL_CLIENT(mcc), item);
return TRUE;
}
@ -199,7 +200,7 @@ void main_channel_client_push_agent_tokens(MainChannelClient *mcc, uint32_t num_
{
RedPipeItem *item = main_agent_tokens_item_new(num_tokens);
red_channel_client_pipe_add_push(&mcc->base, item);
red_channel_client_pipe_add_push(RED_CHANNEL_CLIENT(mcc), item);
}
static void main_agent_data_item_free(RedPipeItem *base)
@ -230,7 +231,7 @@ void main_channel_client_push_agent_data(MainChannelClient *mcc, uint8_t* data,
RedPipeItem *item;
item = main_agent_data_item_new(data, len, free_data, opaque);
red_channel_client_pipe_add_push(&mcc->base, item);
red_channel_client_pipe_add_push(RED_CHANNEL_CLIENT(mcc), item);
}
static RedPipeItem *main_init_item_new(int connection_id,
@ -264,7 +265,7 @@ void main_channel_client_push_init(MainChannelClient *mcc,
item = main_init_item_new(mcc->priv->connection_id, display_channels_hint,
current_mouse_mode, is_client_mouse_allowed,
multi_media_time, ram_hint);
red_channel_client_pipe_add_push(&mcc->base, item);
red_channel_client_pipe_add_push(RED_CHANNEL_CLIENT(mcc), item);
}
static RedPipeItem *main_name_item_new(const char *name)
@ -282,12 +283,12 @@ void main_channel_client_push_name(MainChannelClient *mcc, const char *name)
{
RedPipeItem *item;
if (!red_channel_client_test_remote_cap(&mcc->base,
if (!red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(mcc),
SPICE_MAIN_CAP_NAME_AND_UUID))
return;
item = main_name_item_new(name);
red_channel_client_pipe_add_push(&mcc->base, item);
red_channel_client_pipe_add_push(RED_CHANNEL_CLIENT(mcc), item);
}
static RedPipeItem *main_uuid_item_new(const uint8_t uuid[16])
@ -304,18 +305,18 @@ void main_channel_client_push_uuid(MainChannelClient *mcc, const uint8_t uuid[16
{
RedPipeItem *item;
if (!red_channel_client_test_remote_cap(&mcc->base,
if (!red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(mcc),
SPICE_MAIN_CAP_NAME_AND_UUID))
return;
item = main_uuid_item_new(uuid);
red_channel_client_pipe_add_push(&mcc->base, item);
red_channel_client_pipe_add_push(RED_CHANNEL_CLIENT(mcc), item);
}
void main_channel_client_push_notify(MainChannelClient *mcc, const char *msg)
{
RedPipeItem *item = main_notify_item_new(msg, 1);
red_channel_client_pipe_add_push(&mcc->base, item);
red_channel_client_pipe_add_push(RED_CHANNEL_CLIENT(mcc), item);
}
RedPipeItem *main_mouse_mode_item_new(RedChannelClient *rcc, void *data, int num)
@ -345,10 +346,10 @@ void main_channel_client_handle_migrate_connected(MainChannelClient *mcc,
int success,
int seamless)
{
RedClient *client = red_channel_client_get_client(&mcc->base);
RedClient *client = red_channel_client_get_client(RED_CHANNEL_CLIENT(mcc));
spice_printerr("client %p connected: %d seamless %d", client, success, seamless);
if (mcc->priv->mig_wait_connect) {
RedChannel *channel = red_channel_client_get_channel(&mcc->base);
RedChannel *channel = red_channel_client_get_channel(RED_CHANNEL_CLIENT(mcc));
MainChannel *main_channel = SPICE_CONTAINEROF(channel, MainChannel, base);
mcc->priv->mig_wait_connect = FALSE;
@ -361,7 +362,8 @@ void main_channel_client_handle_migrate_connected(MainChannelClient *mcc,
} else {
if (success) {
spice_printerr("client %p MIGRATE_CANCEL", client);
red_channel_client_pipe_add_empty_msg(&mcc->base, SPICE_MSG_MAIN_MIGRATE_CANCEL);
red_channel_client_pipe_add_empty_msg(RED_CHANNEL_CLIENT(mcc),
SPICE_MSG_MAIN_MIGRATE_CANCEL);
}
}
}
@ -369,13 +371,13 @@ void main_channel_client_handle_migrate_connected(MainChannelClient *mcc,
void main_channel_client_handle_migrate_dst_do_seamless(MainChannelClient *mcc,
uint32_t src_version)
{
RedChannel *channel = red_channel_client_get_channel(&mcc->base);
RedChannel *channel = red_channel_client_get_channel(RED_CHANNEL_CLIENT(mcc));
if (reds_on_migrate_dst_set_seamless(channel->reds, mcc, src_version)) {
mcc->priv->seamless_mig_dst = TRUE;
red_channel_client_pipe_add_empty_msg(&mcc->base,
red_channel_client_pipe_add_empty_msg(RED_CHANNEL_CLIENT(mcc),
SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_ACK);
} else {
red_channel_client_pipe_add_empty_msg(&mcc->base,
red_channel_client_pipe_add_empty_msg(RED_CHANNEL_CLIENT(mcc),
SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_NACK);
}
}
@ -417,7 +419,7 @@ void main_channel_client_handle_pong(MainChannelClient *mcc, SpiceMsgPing *ping,
"bandwidth", mcc->priv->latency, roundtrip);
mcc->priv->latency = 0;
mcc->priv->net_test_stage = NET_TEST_STAGE_INVALID;
red_channel_client_start_connectivity_monitoring(&mcc->base,
red_channel_client_start_connectivity_monitoring(RED_CHANNEL_CLIENT(mcc),
CLIENT_CONNECTIVITY_TIMEOUT);
break;
}
@ -429,7 +431,7 @@ void main_channel_client_handle_pong(MainChannelClient *mcc, SpiceMsgPing *ping,
mcc->priv->bitrate_per_sec,
(double)mcc->priv->bitrate_per_sec / 1024 / 1024,
main_channel_client_is_low_bandwidth(mcc) ? " LOW BANDWIDTH" : "");
red_channel_client_start_connectivity_monitoring(&mcc->base,
red_channel_client_start_connectivity_monitoring(RED_CHANNEL_CLIENT(mcc),
CLIENT_CONNECTIVITY_TIMEOUT);
break;
default:
@ -443,12 +445,12 @@ void main_channel_client_handle_pong(MainChannelClient *mcc, SpiceMsgPing *ping,
void main_channel_client_handle_migrate_end(MainChannelClient *mcc)
{
RedClient *client = red_channel_client_get_client(&mcc->base);
RedClient *client = red_channel_client_get_client(RED_CHANNEL_CLIENT(mcc));
if (!red_client_during_migrate_at_target(client)) {
spice_printerr("unexpected SPICE_MSGC_MIGRATE_END");
return;
}
if (!red_channel_client_test_remote_cap(&mcc->base,
if (!red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(mcc),
SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE)) {
spice_printerr("unexpected SPICE_MSGC_MIGRATE_END, "
"client does not support semi-seamless migration");
@ -461,7 +463,7 @@ void main_channel_client_migrate_cancel_wait(MainChannelClient *mcc)
{
if (mcc->priv->mig_wait_connect) {
spice_printerr("client %p cancel wait connect",
red_channel_client_get_client(&mcc->base));
red_channel_client_get_client(RED_CHANNEL_CLIENT(mcc)));
mcc->priv->mig_wait_connect = FALSE;
mcc->priv->mig_connect_ok = FALSE;
}
@ -472,12 +474,13 @@ void main_channel_client_migrate_dst_complete(MainChannelClient *mcc)
{
if (mcc->priv->mig_wait_prev_complete) {
if (mcc->priv->mig_wait_prev_try_seamless) {
RedChannel *channel = red_channel_client_get_channel(&mcc->base);
RedChannel *channel = red_channel_client_get_channel(RED_CHANNEL_CLIENT(mcc));
spice_assert(g_list_length(channel->clients) == 1);
red_channel_client_pipe_add_type(&mcc->base,
red_channel_client_pipe_add_type(RED_CHANNEL_CLIENT(mcc),
RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN_SEAMLESS);
} else {
red_channel_client_pipe_add_type(&mcc->base, RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN);
red_channel_client_pipe_add_type(RED_CHANNEL_CLIENT(mcc),
RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN);
}
mcc->priv->mig_wait_connect = TRUE;
mcc->priv->mig_wait_prev_complete = FALSE;
@ -488,22 +491,26 @@ gboolean main_channel_client_migrate_src_complete(MainChannelClient *mcc,
gboolean success)
{
gboolean ret = FALSE;
RedClient *client = red_channel_client_get_client(&mcc->base);
int semi_seamless_support = red_channel_client_test_remote_cap(&mcc->base,
RedChannelClient *rcc = RED_CHANNEL_CLIENT(mcc);
RedClient *client = red_channel_client_get_client(rcc);
int semi_seamless_support = red_channel_client_test_remote_cap(rcc,
SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE);
if (semi_seamless_support && mcc->priv->mig_connect_ok) {
if (success) {
spice_printerr("client %p MIGRATE_END", client);
red_channel_client_pipe_add_empty_msg(&mcc->base, SPICE_MSG_MAIN_MIGRATE_END);
red_channel_client_pipe_add_empty_msg(rcc,
SPICE_MSG_MAIN_MIGRATE_END);
ret = TRUE;
} else {
spice_printerr("client %p MIGRATE_CANCEL", client);
red_channel_client_pipe_add_empty_msg(&mcc->base, SPICE_MSG_MAIN_MIGRATE_CANCEL);
red_channel_client_pipe_add_empty_msg(rcc,
SPICE_MSG_MAIN_MIGRATE_CANCEL);
}
} else {
if (success) {
spice_printerr("client %p SWITCH_HOST", client);
red_channel_client_pipe_add_type(&mcc->base, RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_SWITCH_HOST);
red_channel_client_pipe_add_type(rcc,
RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_SWITCH_HOST);
}
}
mcc->priv->mig_connect_ok = FALSE;
@ -516,7 +523,7 @@ gboolean main_channel_client_migrate_src_complete(MainChannelClient *mcc,
static void do_ping_client(MainChannelClient *mcc,
const char *opt, int has_interval, int interval)
{
RedChannel *channel = red_channel_client_get_channel(&mcc->base);
RedChannel *channel = red_channel_client_get_channel(RED_CHANNEL_CLIENT(mcc));
spice_printerr("");
if (!opt) {
main_channel_client_push_ping(mcc, 0);
@ -535,9 +542,9 @@ static void do_ping_client(MainChannelClient *mcc,
static void ping_timer_cb(void *opaque)
{
MainChannelClient *mcc = opaque;
RedChannel *channel = red_channel_client_get_channel(&mcc->base);
RedChannel *channel = red_channel_client_get_channel(RED_CHANNEL_CLIENT(mcc));
if (!red_channel_client_is_connected(&mcc->base)) {
if (!red_channel_client_is_connected(RED_CHANNEL_CLIENT(mcc))) {
spice_printerr("not connected to peer, ping off");
reds_core_timer_cancel(channel->reds, mcc->priv->ping_timer);
return;
@ -598,7 +605,7 @@ void main_channel_client_migrate(RedChannelClient *rcc)
gboolean main_channel_client_connect_semi_seamless(MainChannelClient *mcc)
{
RedChannelClient *rcc = main_channel_client_get_base(mcc);
RedChannelClient *rcc = RED_CHANNEL_CLIENT(mcc);
MainChannel* main_channel = (MainChannel*)red_channel_client_get_channel(rcc);
if (red_channel_client_test_remote_cap(rcc,
SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE)) {
@ -621,27 +628,22 @@ gboolean main_channel_client_connect_semi_seamless(MainChannelClient *mcc)
void main_channel_client_connect_seamless(MainChannelClient *mcc)
{
RedClient *client = red_channel_client_get_client(&mcc->base);
spice_assert(red_channel_client_test_remote_cap(&mcc->base,
RedChannelClient *rcc = RED_CHANNEL_CLIENT(mcc);
RedClient *client = red_channel_client_get_client(rcc);
spice_assert(red_channel_client_test_remote_cap(rcc,
SPICE_MAIN_CAP_SEAMLESS_MIGRATE));
if (red_client_during_migrate_at_target(client)) {
spice_printerr("client %p: wait till previous migration completes", client);
mcc->priv->mig_wait_prev_complete = TRUE;
mcc->priv->mig_wait_prev_try_seamless = TRUE;
} else {
red_channel_client_pipe_add_type(&mcc->base,
red_channel_client_pipe_add_type(rcc,
RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN_SEAMLESS);
mcc->priv->mig_wait_connect = TRUE;
}
mcc->priv->mig_connect_ok = FALSE;
}
RedChannelClient* main_channel_client_get_base(MainChannelClient* mcc)
{
spice_assert(mcc);
return &mcc->base;
}
uint32_t main_channel_client_get_connection_id(MainChannelClient *mcc)
{
return mcc->priv->connection_id;

View File

@ -66,8 +66,6 @@ int main_channel_client_is_low_bandwidth(MainChannelClient *mcc);
uint64_t main_channel_client_get_bitrate_per_sec(MainChannelClient *mcc);
uint64_t main_channel_client_get_roundtrip_ms(MainChannelClient *mcc);
RedChannelClient* main_channel_client_get_base(MainChannelClient* mcc);
void main_channel_client_push_name(MainChannelClient *mcc, const char *name);
void main_channel_client_push_uuid(MainChannelClient *mcc, const uint8_t uuid[16]);

View File

@ -58,13 +58,13 @@ RedClient *main_channel_get_client_by_link_id(MainChannel *main_chan, uint32_t c
static void main_channel_push_channels(MainChannelClient *mcc)
{
RedChannelClient *rcc = main_channel_client_get_base(mcc);
RedChannelClient *rcc = RED_CHANNEL_CLIENT(mcc);
if (red_client_during_migrate_at_target(red_channel_client_get_client(rcc))) {
spice_printerr("warning: ignoring unexpected SPICE_MSGC_MAIN_ATTACH_CHANNELS"
"during migration");
return;
}
red_channel_client_pipe_add_type(main_channel_client_get_base(mcc), RED_PIPE_ITEM_TYPE_MAIN_CHANNELS_LIST);
red_channel_client_pipe_add_type(RED_CHANNEL_CLIENT(mcc), RED_PIPE_ITEM_TYPE_MAIN_CHANNELS_LIST);
}
void main_channel_push_mouse_mode(MainChannel *main_chan, int current_mode,

View File

@ -947,8 +947,7 @@ static void vdi_port_on_free_self_token(void *opaque)
static void vdi_port_remove_client(RedClient *client, void *opaque)
{
red_channel_client_shutdown(main_channel_client_get_base(
red_client_get_main(client)));
red_channel_client_shutdown(RED_CHANNEL_CLIENT(red_client_get_main(client)));
}
/****************************************************************************/
@ -1062,7 +1061,7 @@ void reds_on_main_agent_start(RedsState *reds, MainChannelClient *mcc, uint32_t
return;
}
spice_assert(reds->vdagent->st && reds->vdagent->st == dev_state);
rcc = main_channel_client_get_base(mcc);
rcc = RED_CHANNEL_CLIENT(mcc);
client = red_channel_client_get_client(rcc);
reds->agent_dev->priv->client_agent_started = TRUE;
/*
@ -1102,7 +1101,7 @@ void reds_on_main_agent_start(RedsState *reds, MainChannelClient *mcc, uint32_t
void reds_on_main_agent_tokens(RedsState *reds, MainChannelClient *mcc, uint32_t num_tokens)
{
RedClient *client = red_channel_client_get_client(main_channel_client_get_base(mcc));
RedClient *client = red_channel_client_get_client(RED_CHANNEL_CLIENT(mcc));
if (!reds->vdagent) {
return;
}
@ -1129,7 +1128,7 @@ uint8_t *reds_get_agent_data_buffer(RedsState *reds, MainChannelClient *mcc, siz
}
spice_assert(dev->priv->recv_from_client_buf == NULL);
client = red_channel_client_get_client(main_channel_client_get_base(mcc));
client = red_channel_client_get_client(RED_CHANNEL_CLIENT(mcc));
dev->priv->recv_from_client_buf = red_char_device_write_buffer_get(RED_CHAR_DEVICE(dev),
client,
size + sizeof(VDIChunkHeader));
@ -1213,7 +1212,7 @@ void reds_on_main_agent_data(RedsState *reds, MainChannelClient *mcc, void *mess
reds_on_main_agent_monitors_config(reds, mcc, message, size);
return;
case AGENT_MSG_FILTER_PROTO_ERROR:
red_channel_client_shutdown(main_channel_client_get_base(mcc));
red_channel_client_shutdown(RED_CHANNEL_CLIENT(mcc));
return;
}
@ -1500,7 +1499,7 @@ int reds_handle_migrate_data(RedsState *reds, MainChannelClient *mcc,
} else {
spice_debug("agent was not attached on the source host");
if (reds->vdagent) {
RedClient *client = red_channel_client_get_client(main_channel_client_get_base(mcc));
RedClient *client = red_channel_client_get_client(RED_CHANNEL_CLIENT(mcc));
/* red_char_device_client_remove disables waiting for migration data */
red_char_device_client_remove(RED_CHAR_DEVICE(agent_dev), client);
main_channel_push_agent_connected(reds->main_channel);
@ -1945,7 +1944,7 @@ int reds_on_migrate_dst_set_seamless(RedsState *reds, MainChannelClient *mcc, ui
if (reds->allow_multiple_clients || src_version > SPICE_MIGRATION_PROTOCOL_VERSION) {
reds->dst_do_seamless_migrate = FALSE;
} else {
RedChannelClient *rcc = main_channel_client_get_base(mcc);
RedChannelClient *rcc = RED_CHANNEL_CLIENT(mcc);
RedClient *client = red_channel_client_get_client(rcc);
red_client_set_migration_seamless(client);

View File

@ -326,18 +326,18 @@ static void smartcard_char_device_attach_client(SpiceCharDeviceInstance *char_de
dev->priv->scc = scc;
scc->priv->smartcard = dev;
client_added = red_char_device_client_add(RED_CHAR_DEVICE(dev),
red_channel_client_get_client(&scc->base),
red_channel_client_get_client(RED_CHANNEL_CLIENT(scc)),
FALSE, /* no flow control yet */
0, /* send queue size */
~0,
~0,
red_channel_client_is_waiting_for_migrate_data(
&scc->base));
RED_CHANNEL_CLIENT(scc)));
if (!client_added) {
spice_warning("failed");
dev->priv->scc = NULL;
scc->priv->smartcard = NULL;
red_channel_client_disconnect(&scc->base);
red_channel_client_disconnect(RED_CHANNEL_CLIENT(scc));
}
}
@ -373,7 +373,7 @@ static void smartcard_char_device_detach_client(SmartCardChannelClient *scc)
dev = scc->priv->smartcard;
spice_assert(dev->priv->scc == scc);
red_char_device_client_remove(RED_CHAR_DEVICE(dev),
red_channel_client_get_client(&scc->base));
red_channel_client_get_client(RED_CHANNEL_CLIENT(scc)));
scc->priv->smartcard = NULL;
dev->priv->scc = NULL;
}
@ -573,14 +573,14 @@ static void smartcard_remove_reader(SmartCardChannelClient *scc, uint32_t reader
RedCharDeviceSmartcard *dev;
if (char_device == NULL) {
smartcard_push_error(&scc->base, reader_id,
smartcard_push_error(RED_CHANNEL_CLIENT(scc), reader_id,
VSC_GENERAL_ERROR);
return;
}
dev = red_char_device_opaque_get(char_device->st);
if (dev->priv->reader_added == FALSE) {
smartcard_push_error(&scc->base, reader_id,
smartcard_push_error(RED_CHANNEL_CLIENT(scc), reader_id,
VSC_GENERAL_ERROR);
return;
}
@ -595,7 +595,8 @@ static void smartcard_add_reader(SmartCardChannelClient *scc, uint8_t *name)
SpiceCharDeviceInstance *char_device = smartcard_readers_get_unattached();
if (!char_device) {
smartcard_push_error(&scc->base, VSCARD_UNDEFINED_READER_ID,
smartcard_push_error(RED_CHANNEL_CLIENT(scc),
VSCARD_UNDEFINED_READER_ID,
VSC_CANNOT_ADD_MORE_READERS);
return;
}
@ -769,7 +770,7 @@ static void smartcard_connect_client(RedChannel *channel, RedClient *client,
if (!scc) {
return;
}
red_channel_client_ack_zero_messages_window(&scc->base);
red_channel_client_ack_zero_messages_window(RED_CHANNEL_CLIENT(scc));
if (char_device) {
smartcard_char_device_attach_client(char_device, scc);