mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-05 04:02:43 +00:00
red-client: Automatically convert functions to methods
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
43c6bf91b7
commit
cc86a7fb53
@ -46,7 +46,7 @@ void CommonGraphicsChannelClient::release_recv_buf(uint16_t type, uint32_t size,
|
||||
bool CommonGraphicsChannelClient::config_socket()
|
||||
{
|
||||
RedClient *client = get_client();
|
||||
MainChannelClient *mcc = red_client_get_main(client);
|
||||
MainChannelClient *mcc = client->get_main();
|
||||
RedStream *stream = get_stream();
|
||||
gboolean is_low_bandwidth;
|
||||
|
||||
|
||||
@ -1260,7 +1260,7 @@ void dcc_set_max_stream_bit_rate(DisplayChannelClient *dcc, uint64_t rate)
|
||||
bool DisplayChannelClient::config_socket()
|
||||
{
|
||||
RedClient *client = get_client();
|
||||
MainChannelClient *mcc = red_client_get_main(client);
|
||||
MainChannelClient *mcc = client->get_main();
|
||||
|
||||
is_low_bandwidth = main_channel_client_is_low_bandwidth(mcc);
|
||||
|
||||
|
||||
@ -445,8 +445,8 @@ void InputsChannelClient::pipe_add_init()
|
||||
void InputsChannel::on_connect(RedClient *client, RedStream *stream, int migration,
|
||||
RedChannelCapabilities *caps)
|
||||
{
|
||||
if (!red_stream_is_ssl(stream) && !red_client_during_migrate_at_target(client)) {
|
||||
main_channel_client_push_notify(red_client_get_main(client),
|
||||
if (!red_stream_is_ssl(stream) && !client->during_migrate_at_target()) {
|
||||
main_channel_client_push_notify(client->get_main(),
|
||||
"keyboard channel is insecure");
|
||||
}
|
||||
|
||||
|
||||
@ -462,7 +462,7 @@ void MainChannelClient::handle_pong(SpiceMsgPing *ping, uint32_t size)
|
||||
void main_channel_client_handle_migrate_end(MainChannelClient *mcc)
|
||||
{
|
||||
RedClient *client = mcc->get_client();
|
||||
if (!red_client_during_migrate_at_target(client)) {
|
||||
if (!client->during_migrate_at_target()) {
|
||||
red_channel_warning(mcc->get_channel(),
|
||||
"unexpected SPICE_MSGC_MIGRATE_END");
|
||||
return;
|
||||
@ -473,7 +473,7 @@ void main_channel_client_handle_migrate_end(MainChannelClient *mcc)
|
||||
"client does not support semi-seamless migration");
|
||||
return;
|
||||
}
|
||||
red_client_semi_seamless_migrate_complete(client);
|
||||
client->semi_seamless_migrate_complete();
|
||||
}
|
||||
|
||||
void main_channel_client_migrate_cancel_wait(MainChannelClient *mcc)
|
||||
@ -578,7 +578,7 @@ gboolean main_channel_client_connect_semi_seamless(MainChannelClient *mcc)
|
||||
{
|
||||
if (mcc->test_remote_cap(SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE)) {
|
||||
RedClient *client = mcc->get_client();
|
||||
if (red_client_during_migrate_at_target(client)) {
|
||||
if (client->during_migrate_at_target()) {
|
||||
mcc->priv->mig_wait_prev_complete = TRUE;
|
||||
mcc->priv->mig_wait_prev_try_seamless = FALSE;
|
||||
} else {
|
||||
@ -595,7 +595,7 @@ void main_channel_client_connect_seamless(MainChannelClient *mcc)
|
||||
{
|
||||
RedClient *client = mcc->get_client();
|
||||
spice_assert(mcc->test_remote_cap(SPICE_MAIN_CAP_SEAMLESS_MIGRATE));
|
||||
if (red_client_during_migrate_at_target(client)) {
|
||||
if (client->during_migrate_at_target()) {
|
||||
mcc->priv->mig_wait_prev_complete = TRUE;
|
||||
mcc->priv->mig_wait_prev_try_seamless = TRUE;
|
||||
} else {
|
||||
|
||||
@ -48,7 +48,7 @@ RedClient *main_channel_get_client_by_link_id(MainChannel *main_chan, uint32_t c
|
||||
|
||||
static void main_channel_push_channels(MainChannelClient *mcc)
|
||||
{
|
||||
if (red_client_during_migrate_at_target(mcc->get_client())) {
|
||||
if (mcc->get_client()->during_migrate_at_target()) {
|
||||
red_channel_warning(mcc->get_channel(),
|
||||
"warning: ignoring unexpected SPICE_MSGC_MAIN_ATTACH_CHANNELS"
|
||||
"during migration");
|
||||
|
||||
@ -159,7 +159,7 @@ void MainDispatcher::client_disconnect(RedClient *client)
|
||||
{
|
||||
MainDispatcherClientDisconnectMessage msg;
|
||||
|
||||
if (!red_client_is_disconnecting(client)) {
|
||||
if (!client->is_disconnecting()) {
|
||||
spice_debug("client %p", client);
|
||||
msg.client = red::add_ref(client);
|
||||
send_message(MAIN_DISPATCHER_CLIENT_DISCONNECT, &msg);
|
||||
|
||||
@ -707,7 +707,7 @@ void RedChannelClient::start_connectivity_monitoring(uint32_t timeout_ms)
|
||||
priv->cancel_ping_timer();
|
||||
}
|
||||
priv->latency_monitor.timeout = PING_TEST_TIMEOUT_MS;
|
||||
if (!red_client_during_migrate_at_target(priv->client)) {
|
||||
if (!priv->client->during_migrate_at_target()) {
|
||||
priv->start_ping_timer(PING_TEST_IDLE_NET_TIMEOUT_MS);
|
||||
}
|
||||
if (priv->connectivity_monitor.timer == NULL) {
|
||||
@ -715,7 +715,7 @@ void RedChannelClient::start_connectivity_monitoring(uint32_t timeout_ms)
|
||||
priv->connectivity_monitor.timer =
|
||||
core->timer_new(connectivity_timer, this);
|
||||
priv->connectivity_monitor.timeout = timeout_ms;
|
||||
if (!red_client_during_migrate_at_target(priv->client)) {
|
||||
if (!priv->client->during_migrate_at_target()) {
|
||||
red_timer_start(priv->connectivity_monitor.timer,
|
||||
priv->connectivity_monitor.timeout);
|
||||
}
|
||||
@ -827,7 +827,7 @@ bool RedChannelClient::init()
|
||||
priv->latency_monitor.timer =
|
||||
core->timer_new(ping_timer, this);
|
||||
|
||||
if (!red_client_during_migrate_at_target(priv->client)) {
|
||||
if (!priv->client->during_migrate_at_target()) {
|
||||
priv->start_ping_timer(PING_TEST_IDLE_NET_TIMEOUT_MS);
|
||||
}
|
||||
priv->latency_monitor.roundtrip = -1;
|
||||
@ -836,7 +836,7 @@ bool RedChannelClient::init()
|
||||
}
|
||||
|
||||
priv->channel->add_client(this);
|
||||
if (!red_client_add_channel(priv->client, this, &local_error)) {
|
||||
if (!priv->client->add_channel(this, &local_error)) {
|
||||
priv->channel->remove_client(this);
|
||||
}
|
||||
|
||||
@ -885,7 +885,7 @@ void RedChannelClientPrivate::seamless_migration_done()
|
||||
{
|
||||
wait_migrate_data = FALSE;
|
||||
|
||||
if (red_client_seamless_migration_done_for_channel(client)) {
|
||||
if (client->seamless_migration_done_for_channel()) {
|
||||
start_ping_timer(PING_TEST_IDLE_NET_TIMEOUT_MS);
|
||||
if (connectivity_monitor.timer) {
|
||||
red_timer_start(connectivity_monitor.timer,
|
||||
@ -1547,7 +1547,7 @@ void RedChannelClient::disconnect()
|
||||
// remove client from RedClient
|
||||
// NOTE this may trigger the free of the object, if we are in a watch/timer
|
||||
// we should make sure we keep a reference
|
||||
red_client_remove_channel(this);
|
||||
get_client()->remove_channel(this);
|
||||
}
|
||||
|
||||
bool RedChannelClient::is_blocked() const
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
#include "reds.h"
|
||||
|
||||
#define FOREACH_CHANNEL_CLIENT(_client, _data) \
|
||||
GLIST_FOREACH((_client ? (_client)->channels : NULL), RedChannelClient, _data)
|
||||
GLIST_FOREACH(_client->channels, RedChannelClient, _data)
|
||||
|
||||
struct RedClientClass
|
||||
{
|
||||
@ -133,36 +133,36 @@ RedClient *red_client_new(RedsState *reds, int migrated)
|
||||
NULL);
|
||||
}
|
||||
|
||||
void red_client_set_migration_seamless(RedClient *client) // dest
|
||||
void RedClient::set_migration_seamless() // dest
|
||||
{
|
||||
RedChannelClient *rcc;
|
||||
|
||||
spice_assert(client->during_target_migrate);
|
||||
pthread_mutex_lock(&client->lock);
|
||||
client->seamless_migrate = TRUE;
|
||||
spice_assert(during_target_migrate);
|
||||
pthread_mutex_lock(&lock);
|
||||
seamless_migrate = TRUE;
|
||||
/* update channel clients that got connected before the migration
|
||||
* type was set. red_client_add_channel will handle newer channel clients */
|
||||
FOREACH_CHANNEL_CLIENT(client, rcc) {
|
||||
FOREACH_CHANNEL_CLIENT(this, rcc) {
|
||||
if (rcc->set_migration_seamless()) {
|
||||
client->num_migrated_channels++;
|
||||
num_migrated_channels++;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&client->lock);
|
||||
pthread_mutex_unlock(&lock);
|
||||
}
|
||||
|
||||
void red_client_migrate(RedClient *client)
|
||||
void RedClient::migrate()
|
||||
{
|
||||
RedChannelClient *rcc;
|
||||
RedChannel *channel;
|
||||
|
||||
if (!pthread_equal(pthread_self(), client->thread_id)) {
|
||||
if (!pthread_equal(pthread_self(), thread_id)) {
|
||||
spice_warning("client->thread_id (%p) != "
|
||||
"pthread_self (%p)."
|
||||
"If one of the threads is != io-thread && != vcpu-thread,"
|
||||
" this might be a BUG",
|
||||
(void*) client->thread_id, (void*) pthread_self());
|
||||
(void*) thread_id, (void*) pthread_self());
|
||||
}
|
||||
FOREACH_CHANNEL_CLIENT(client, rcc) {
|
||||
FOREACH_CHANNEL_CLIENT(this, rcc) {
|
||||
if (rcc->is_connected()) {
|
||||
channel = rcc->get_channel();
|
||||
channel->migrate_client(rcc);
|
||||
@ -170,35 +170,35 @@ void red_client_migrate(RedClient *client)
|
||||
}
|
||||
}
|
||||
|
||||
void red_client_destroy(RedClient *client)
|
||||
void RedClient::destroy()
|
||||
{
|
||||
if (!pthread_equal(pthread_self(), client->thread_id)) {
|
||||
if (!pthread_equal(pthread_self(), thread_id)) {
|
||||
spice_warning("client->thread_id (%p) != "
|
||||
"pthread_self (%p)."
|
||||
"If one of the threads is != io-thread && != vcpu-thread,"
|
||||
" this might be a BUG",
|
||||
(void*) client->thread_id,
|
||||
(void*) thread_id,
|
||||
(void*) pthread_self());
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&client->lock);
|
||||
spice_debug("destroy client %p with #channels=%d", client, g_list_length(client->channels));
|
||||
pthread_mutex_lock(&lock);
|
||||
spice_debug("destroy this %p with #channels=%d", this, g_list_length(channels));
|
||||
// This makes sure that we won't try to add new RedChannelClient instances
|
||||
// to the RedClient::channels list while iterating it
|
||||
client->disconnecting = TRUE;
|
||||
while (client->channels) {
|
||||
disconnecting = TRUE;
|
||||
while (channels) {
|
||||
RedChannel *channel;
|
||||
RedChannelClient *rcc = (RedChannelClient *) client->channels->data;
|
||||
RedChannelClient *rcc = (RedChannelClient *) channels->data;
|
||||
|
||||
// Remove the RedChannelClient we are processing from the list
|
||||
// Note that we own the object so it is safe to do some operations on it.
|
||||
// This manual scan of the list is done to have a thread safe
|
||||
// iteration of the list
|
||||
client->channels = g_list_delete_link(client->channels, client->channels);
|
||||
channels = g_list_delete_link(channels, channels);
|
||||
|
||||
// prevent dead lock disconnecting rcc (which can happen
|
||||
// in the same thread or synchronously on another one)
|
||||
pthread_mutex_unlock(&client->lock);
|
||||
pthread_mutex_unlock(&lock);
|
||||
|
||||
// some channels may be in other threads, so disconnection
|
||||
// is not synchronous.
|
||||
@ -215,10 +215,10 @@ void red_client_destroy(RedClient *client)
|
||||
spice_assert(rcc->no_item_being_sent());
|
||||
|
||||
rcc->unref();
|
||||
pthread_mutex_lock(&client->lock);
|
||||
pthread_mutex_lock(&lock);
|
||||
}
|
||||
pthread_mutex_unlock(&client->lock);
|
||||
client->unref();
|
||||
pthread_mutex_unlock(&lock);
|
||||
unref();
|
||||
}
|
||||
|
||||
|
||||
@ -238,91 +238,91 @@ static RedChannelClient *red_client_get_channel(RedClient *client, int type, int
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean red_client_add_channel(RedClient *client, RedChannelClient *rcc, GError **error)
|
||||
gboolean RedClient::add_channel(RedChannelClient *rcc, GError **error)
|
||||
{
|
||||
RedChannel *channel;
|
||||
gboolean result = TRUE;
|
||||
|
||||
spice_assert(rcc && client);
|
||||
spice_assert(rcc);
|
||||
channel = rcc->get_channel();
|
||||
|
||||
pthread_mutex_lock(&client->lock);
|
||||
pthread_mutex_lock(&lock);
|
||||
|
||||
uint32_t type = channel->type();
|
||||
uint32_t id = channel->id();
|
||||
if (client->disconnecting) {
|
||||
if (disconnecting) {
|
||||
g_set_error(error,
|
||||
SPICE_SERVER_ERROR,
|
||||
SPICE_SERVER_ERROR_FAILED,
|
||||
"Client %p got disconnected while connecting channel type %d id %d",
|
||||
client, type, id);
|
||||
this, type, id);
|
||||
result = FALSE;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (red_client_get_channel(client, type, id)) {
|
||||
if (red_client_get_channel(this, type, id)) {
|
||||
g_set_error(error,
|
||||
SPICE_SERVER_ERROR,
|
||||
SPICE_SERVER_ERROR_FAILED,
|
||||
"Client %p: duplicate channel type %d id %d",
|
||||
client, type, id);
|
||||
this, type, id);
|
||||
result = FALSE;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// first must be the main one
|
||||
if (!client->mcc) {
|
||||
if (!mcc) {
|
||||
// FIXME use dynamic_cast to check type
|
||||
// spice_assert(MAIN_CHANNEL_CLIENT(rcc) != NULL);
|
||||
rcc->ref();
|
||||
client->mcc = (MainChannelClient *) rcc;
|
||||
mcc = (MainChannelClient *) rcc;
|
||||
}
|
||||
client->channels = g_list_prepend(client->channels, rcc);
|
||||
if (client->during_target_migrate && client->seamless_migrate) {
|
||||
channels = g_list_prepend(channels, rcc);
|
||||
if (during_target_migrate && seamless_migrate) {
|
||||
if (rcc->set_migration_seamless()) {
|
||||
client->num_migrated_channels++;
|
||||
num_migrated_channels++;
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
pthread_mutex_unlock(&client->lock);
|
||||
pthread_mutex_unlock(&lock);
|
||||
return result;
|
||||
}
|
||||
|
||||
MainChannelClient *red_client_get_main(RedClient *client)
|
||||
MainChannelClient *RedClient::get_main()
|
||||
{
|
||||
return client->mcc;
|
||||
return mcc;
|
||||
}
|
||||
|
||||
void red_client_semi_seamless_migrate_complete(RedClient *client)
|
||||
void RedClient::semi_seamless_migrate_complete()
|
||||
{
|
||||
RedChannelClient *rcc;
|
||||
|
||||
pthread_mutex_lock(&client->lock);
|
||||
if (!client->during_target_migrate || client->seamless_migrate) {
|
||||
pthread_mutex_lock(&lock);
|
||||
if (!during_target_migrate || seamless_migrate) {
|
||||
spice_error("unexpected");
|
||||
pthread_mutex_unlock(&client->lock);
|
||||
pthread_mutex_unlock(&lock);
|
||||
return;
|
||||
}
|
||||
client->during_target_migrate = FALSE;
|
||||
FOREACH_CHANNEL_CLIENT(client, rcc) {
|
||||
during_target_migrate = FALSE;
|
||||
FOREACH_CHANNEL_CLIENT(this, rcc) {
|
||||
rcc->semi_seamless_migration_complete();
|
||||
}
|
||||
pthread_mutex_unlock(&client->lock);
|
||||
reds_on_client_semi_seamless_migrate_complete(client->reds, client);
|
||||
pthread_mutex_unlock(&lock);
|
||||
reds_on_client_semi_seamless_migrate_complete(reds, this);
|
||||
}
|
||||
|
||||
/* should be called only from the main thread */
|
||||
int red_client_during_migrate_at_target(RedClient *client)
|
||||
int RedClient::during_migrate_at_target()
|
||||
{
|
||||
int ret;
|
||||
pthread_mutex_lock(&client->lock);
|
||||
ret = client->during_target_migrate;
|
||||
pthread_mutex_unlock(&client->lock);
|
||||
pthread_mutex_lock(&lock);
|
||||
ret = during_target_migrate;
|
||||
pthread_mutex_unlock(&lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void red_client_remove_channel(RedChannelClient *rcc)
|
||||
void RedClient::remove_channel(RedChannelClient *rcc)
|
||||
{
|
||||
RedClient *client = rcc->get_client();
|
||||
pthread_mutex_lock(&client->lock);
|
||||
@ -337,44 +337,44 @@ void red_client_remove_channel(RedChannelClient *rcc)
|
||||
}
|
||||
|
||||
/* returns TRUE If all channels are finished migrating, FALSE otherwise */
|
||||
gboolean red_client_seamless_migration_done_for_channel(RedClient *client)
|
||||
gboolean RedClient::seamless_migration_done_for_channel()
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
|
||||
pthread_mutex_lock(&client->lock);
|
||||
client->num_migrated_channels--;
|
||||
pthread_mutex_lock(&lock);
|
||||
num_migrated_channels--;
|
||||
/* we assume we always have at least one channel who has migration data transfer,
|
||||
* otherwise, this flag will never be set back to FALSE*/
|
||||
if (!client->num_migrated_channels) {
|
||||
client->during_target_migrate = FALSE;
|
||||
client->seamless_migrate = FALSE;
|
||||
if (!num_migrated_channels) {
|
||||
during_target_migrate = FALSE;
|
||||
seamless_migrate = FALSE;
|
||||
/* migration completion might have been triggered from a different thread
|
||||
* than the main thread */
|
||||
reds_get_main_dispatcher(client->reds)->seamless_migrate_dst_complete(client);
|
||||
reds_get_main_dispatcher(reds)->seamless_migrate_dst_complete(this);
|
||||
ret = TRUE;
|
||||
}
|
||||
pthread_mutex_unlock(&client->lock);
|
||||
pthread_mutex_unlock(&lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean red_client_is_disconnecting(RedClient *client)
|
||||
gboolean RedClient::is_disconnecting()
|
||||
{
|
||||
gboolean ret;
|
||||
pthread_mutex_lock(&client->lock);
|
||||
ret = client->disconnecting;
|
||||
pthread_mutex_unlock(&client->lock);
|
||||
pthread_mutex_lock(&lock);
|
||||
ret = disconnecting;
|
||||
pthread_mutex_unlock(&lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void red_client_set_disconnecting(RedClient *client)
|
||||
void RedClient::set_disconnecting()
|
||||
{
|
||||
pthread_mutex_lock(&client->lock);
|
||||
client->disconnecting = TRUE;
|
||||
pthread_mutex_unlock(&client->lock);
|
||||
pthread_mutex_lock(&lock);
|
||||
disconnecting = TRUE;
|
||||
pthread_mutex_unlock(&lock);
|
||||
}
|
||||
|
||||
RedsState *red_client_get_server(RedClient *client)
|
||||
RedsState *RedClient::get_server()
|
||||
{
|
||||
return client->reds;
|
||||
return reds;
|
||||
}
|
||||
|
||||
@ -23,42 +23,42 @@
|
||||
|
||||
#include "main-channel-client.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#include "push-visibility.h"
|
||||
|
||||
SPICE_DECLARE_TYPE(RedClient, red_client, CLIENT);
|
||||
#define RED_TYPE_CLIENT red_client_get_type()
|
||||
|
||||
RedClient *red_client_new(RedsState *reds, int migrated);
|
||||
|
||||
/*
|
||||
* disconnects all the client's channels (should be called from the client's thread)
|
||||
*/
|
||||
void red_client_destroy(RedClient *client);
|
||||
|
||||
gboolean red_client_add_channel(RedClient *client, RedChannelClient *rcc, GError **error);
|
||||
void red_client_remove_channel(RedChannelClient *rcc);
|
||||
|
||||
MainChannelClient *red_client_get_main(RedClient *client);
|
||||
|
||||
/* called when the migration handshake results in seamless migration (dst side).
|
||||
* By default we assume semi-seamless */
|
||||
void red_client_set_migration_seamless(RedClient *client);
|
||||
void red_client_semi_seamless_migrate_complete(RedClient *client); /* dst side */
|
||||
gboolean red_client_seamless_migration_done_for_channel(RedClient *client);
|
||||
/* TRUE if the migration is seamless and there are still channels that wait from migration data.
|
||||
* Or, during semi-seamless migration, and the main channel still waits for MIGRATE_END
|
||||
* from the client.
|
||||
* Note: Call it only from the main thread */
|
||||
int red_client_during_migrate_at_target(RedClient *client);
|
||||
|
||||
void red_client_migrate(RedClient *client);
|
||||
|
||||
gboolean red_client_is_disconnecting(RedClient *client);
|
||||
void red_client_set_disconnecting(RedClient *client);
|
||||
RedsState* red_client_get_server(RedClient *client);
|
||||
|
||||
struct RedClient: public GObject
|
||||
{
|
||||
/*
|
||||
* disconnects all the client's channels (should be called from the client's thread)
|
||||
*/
|
||||
void destroy();
|
||||
|
||||
gboolean add_channel(RedChannelClient *rcc, GError **error);
|
||||
static void remove_channel(RedChannelClient *rcc);
|
||||
|
||||
MainChannelClient *get_main();
|
||||
|
||||
/* called when the migration handshake results in seamless migration (dst side).
|
||||
* By default we assume semi-seamless */
|
||||
void set_migration_seamless();
|
||||
void semi_seamless_migrate_complete(); /* dst side */
|
||||
gboolean seamless_migration_done_for_channel();
|
||||
/* TRUE if the migration is seamless and there are still channels that wait from migration data.
|
||||
* Or, during semi-seamless migration, and the main channel still waits for MIGRATE_END
|
||||
* from the client.
|
||||
* Note: Call it only from the main thread */
|
||||
int during_migrate_at_target();
|
||||
|
||||
void migrate();
|
||||
|
||||
gboolean is_disconnecting();
|
||||
void set_disconnecting();
|
||||
RedsState* get_server();
|
||||
|
||||
RedsState *reds;
|
||||
GList *channels;
|
||||
MainChannelClient *mcc;
|
||||
@ -81,6 +81,6 @@ struct RedClient: public GObject
|
||||
void unref() { g_object_unref(this); }
|
||||
};
|
||||
|
||||
G_END_DECLS
|
||||
#include "pop-visibility.h"
|
||||
|
||||
#endif /* RED_CLIENT_H_ */
|
||||
|
||||
@ -497,7 +497,7 @@ void reds_client_disconnect(RedsState *reds, RedClient *client)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (!client || red_client_is_disconnecting(client)) {
|
||||
if (!client || client->is_disconnecting()) {
|
||||
spice_debug("client %p already during disconnection", client);
|
||||
return;
|
||||
}
|
||||
@ -507,7 +507,7 @@ void reds_client_disconnect(RedsState *reds, RedClient *client)
|
||||
* main_channel_client_on_disconnect->
|
||||
* reds_client_disconnect->red_client_destroy->main_channel...
|
||||
*/
|
||||
red_client_set_disconnecting(client);
|
||||
client->set_disconnecting();
|
||||
|
||||
// TODO: we need to handle agent properly for all clients!!!! (e.g., cut and paste, how?)
|
||||
// We shouldn't initialize the agent when there are still clients connected
|
||||
@ -528,7 +528,7 @@ void reds_client_disconnect(RedsState *reds, RedClient *client)
|
||||
}
|
||||
|
||||
reds->clients = g_list_remove(reds->clients, client);
|
||||
red_client_destroy(client);
|
||||
client->destroy();
|
||||
|
||||
// TODO: we need to handle agent properly for all clients!!!! (e.g., cut and paste, how? Maybe throw away messages
|
||||
// if we are in the middle of one from another client)
|
||||
@ -943,7 +943,7 @@ static void vdi_port_send_msg_to_client(RedCharDevice *self,
|
||||
RedVDIReadBuf *agent_data_buf = (RedVDIReadBuf *)msg;
|
||||
|
||||
red_pipe_item_ref(msg);
|
||||
main_channel_client_push_agent_data(red_client_get_main(client),
|
||||
main_channel_client_push_agent_data(client->get_main(),
|
||||
agent_data_buf->data,
|
||||
agent_data_buf->len,
|
||||
vdi_port_read_buf_release,
|
||||
@ -954,7 +954,7 @@ static void vdi_port_send_tokens_to_client(RedCharDevice *self,
|
||||
RedClient *client,
|
||||
uint32_t tokens)
|
||||
{
|
||||
main_channel_client_push_agent_tokens(red_client_get_main(client),
|
||||
main_channel_client_push_agent_tokens(client->get_main(),
|
||||
tokens);
|
||||
}
|
||||
|
||||
@ -976,7 +976,7 @@ static void vdi_port_on_free_self_token(RedCharDevice *self)
|
||||
static void vdi_port_remove_client(RedCharDevice *self,
|
||||
RedClient *client)
|
||||
{
|
||||
red_client_get_main(client)->shutdown();
|
||||
client->get_main()->shutdown();
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
@ -1942,7 +1942,7 @@ static void reds_channel_do_link(RedChannel *channel, RedClient *client,
|
||||
|
||||
red_channel_capabilities_init_from_link_message(&caps, link_msg);
|
||||
channel->connect(client, stream,
|
||||
red_client_during_migrate_at_target(client), &caps);
|
||||
client->during_migrate_at_target(), &caps);
|
||||
red_channel_capabilities_reset(&caps);
|
||||
}
|
||||
|
||||
@ -1997,7 +1997,7 @@ int reds_on_migrate_dst_set_seamless(RedsState *reds, MainChannelClient *mcc, ui
|
||||
} else {
|
||||
RedClient *client = mcc->get_client();
|
||||
|
||||
red_client_set_migration_seamless(client);
|
||||
client->set_migration_seamless();
|
||||
/* linking all the channels that have been connected before migration handshake */
|
||||
reds->dst_do_seamless_migrate = reds_link_mig_target_channels(reds, client);
|
||||
}
|
||||
@ -2011,7 +2011,7 @@ void reds_on_client_seamless_migrate_complete(RedsState *reds, RedClient *client
|
||||
spice_debug("client no longer exists");
|
||||
return;
|
||||
}
|
||||
main_channel_client_migrate_dst_complete(red_client_get_main(client));
|
||||
main_channel_client_migrate_dst_complete(client->get_main());
|
||||
}
|
||||
|
||||
void reds_on_client_semi_seamless_migrate_complete(RedsState *reds, RedClient *client)
|
||||
@ -2019,7 +2019,7 @@ void reds_on_client_semi_seamless_migrate_complete(RedsState *reds, RedClient *c
|
||||
MainChannelClient *mcc;
|
||||
|
||||
spice_debug("%p", client);
|
||||
mcc = red_client_get_main(client);
|
||||
mcc = client->get_main();
|
||||
|
||||
// TODO: not doing net test. consider doing it on client_migrate_info
|
||||
main_channel_client_push_init(mcc, g_list_length(reds->qxl_instances),
|
||||
@ -2073,7 +2073,7 @@ static void reds_handle_other_links(RedsState *reds, RedLinkInfo *link)
|
||||
* migration completes, as soon as we receive SPICE_MSGC_MAIN_MIGRATE_DST_DO_SEAMLESS.
|
||||
* If a channel connects before receiving SPICE_MSGC_MAIN_MIGRATE_DST_DO_SEAMLESS,
|
||||
* reds_on_migrate_dst_set_seamless will take care of activating it */
|
||||
if (red_client_during_migrate_at_target(client) && !reds->dst_do_seamless_migrate) {
|
||||
if (client->during_migrate_at_target() && !reds->dst_do_seamless_migrate) {
|
||||
spice_assert(mig_client);
|
||||
reds_mig_target_client_add_pending_link(mig_client, link_mess, link->stream);
|
||||
link->link_mess = NULL;
|
||||
@ -3045,7 +3045,7 @@ static void reds_migrate_channels_seamless(RedsState *reds)
|
||||
|
||||
/* seamless migration is supported for only one client for now */
|
||||
client = reds_get_client(reds);
|
||||
red_client_migrate(client);
|
||||
client->migrate();
|
||||
}
|
||||
|
||||
static void reds_mig_finished(RedsState *reds, int completed)
|
||||
|
||||
@ -734,7 +734,7 @@ bool SndChannelClient::config_socket()
|
||||
{
|
||||
RedStream *stream = get_stream();
|
||||
RedClient *red_client = get_client();
|
||||
MainChannelClient *mcc = red_client_get_main(red_client);
|
||||
MainChannelClient *mcc = red_client->get_main();
|
||||
|
||||
#ifdef SO_PRIORITY
|
||||
int priority = 6;
|
||||
@ -1033,7 +1033,7 @@ bool PlaybackChannelClient::init()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!red_client_during_migrate_at_target(red_client)) {
|
||||
if (!red_client->during_migrate_at_target()) {
|
||||
snd_set_command(scc, SND_PLAYBACK_MODE_MASK);
|
||||
if (channel->volume.volume_nchannels) {
|
||||
snd_set_command(scc, SND_VOLUME_MUTE_MASK);
|
||||
|
||||
@ -259,7 +259,7 @@ static void channel_loop(void)
|
||||
basic_event_loop_mainloop();
|
||||
|
||||
// cleanup
|
||||
red_client_destroy(client);
|
||||
client->destroy();
|
||||
main_channel->unref();
|
||||
channel->unref();
|
||||
|
||||
|
||||
@ -382,7 +382,7 @@ static void test_smartcard(TestFixture *fixture, gconstpointer user_data)
|
||||
if (watch) {
|
||||
core->watch_remove(watch);
|
||||
}
|
||||
red_client_destroy(client);
|
||||
client->destroy();
|
||||
main_channel->unref();
|
||||
channel->unref();
|
||||
}
|
||||
|
||||
@ -640,7 +640,7 @@ static uint64_t get_initial_bit_rate(DisplayChannelClient *dcc, VideoStream *str
|
||||
MainChannelClient *mcc;
|
||||
uint64_t net_test_bit_rate;
|
||||
|
||||
mcc = red_client_get_main(dcc->get_client());
|
||||
mcc = dcc->get_client()->get_main();
|
||||
net_test_bit_rate = main_channel_client_is_network_info_initialized(mcc) ?
|
||||
main_channel_client_get_bitrate_per_sec(mcc) :
|
||||
0;
|
||||
@ -673,7 +673,7 @@ static uint32_t get_roundtrip_ms(void *opaque)
|
||||
|
||||
roundtrip = rcc->get_roundtrip_ms();
|
||||
if (roundtrip < 0) {
|
||||
MainChannelClient *mcc = red_client_get_main(rcc->get_client());
|
||||
MainChannelClient *mcc = rcc->get_client()->get_main();
|
||||
|
||||
/*
|
||||
* the main channel client roundtrip might not have been
|
||||
@ -698,7 +698,7 @@ static void update_client_playback_delay(void *opaque, uint32_t delay_ms)
|
||||
VideoStreamAgent *agent = (VideoStreamAgent*) opaque;
|
||||
DisplayChannelClient *dcc = agent->dcc;
|
||||
RedClient *client = dcc->get_client();
|
||||
RedsState *reds = red_client_get_server(client);
|
||||
RedsState *reds = client->get_server();
|
||||
|
||||
dcc_update_streams_max_latency(dcc, agent);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user