示例#1
0
文件: spicevmc.c 项目: Fantu/spice
/* Must be called from RedClient handling thread. */
void spicevmc_device_disconnect(SpiceCharDeviceInstance *sin)
{
    SpiceVmcState *state;

    state = (SpiceVmcState *)spice_char_device_state_opaque_get(sin->st);

    if (state->recv_from_client_buf) {
        spice_char_device_write_buffer_release(state->chardev_st, state->recv_from_client_buf);
    }
    spice_char_device_state_destroy(sin->st);
    state->chardev_st = NULL;

    reds_unregister_channel(&state->channel);
    free(state->pipe_item);
    red_channel_destroy(&state->channel);
}
示例#2
0
static void smartcard_link(Channel *channel, RedsStreamContext *peer,
                        int migration, int num_common_caps,
                        uint32_t *common_caps, int num_caps,
                        uint32_t *caps)
{
    if (g_smartcard_channel) {
        red_channel_destroy(&g_smartcard_channel->base);
    }
    g_smartcard_channel =
        (SmartCardChannel *)red_channel_create(sizeof(*g_smartcard_channel),
                                        peer, core,
                                        migration, FALSE /* handle_acks */,
                                        smartcard_channel_config_socket,
                                        smartcard_channel_disconnect,
                                        smartcard_channel_handle_message,
                                        smartcard_channel_alloc_msg_rcv_buf,
                                        smartcard_channel_release_msg_rcv_buf,
                                        smartcard_channel_send_item,
                                        smartcard_channel_release_pipe_item);
    if (!g_smartcard_channel) {
        return;
    }
    red_channel_init_outgoing_messages_window(&g_smartcard_channel->base);
}
示例#3
0
static void smartcard_channel_disconnect(RedChannel *channel)
{
    smartcard_readers_detach_all((SmartCardChannel*)channel);
    red_channel_destroy(channel);
    g_smartcard_channel = NULL;
}