mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-06 20:27:43 +00:00
red-channel: Update some comment and function
red_channel_client_destroy is not called anymore from RedClient and should not so update the comments. red_channel_client_destroy, compared to other XXX_destroy functions did not unreference the object but was just disconnecting the client channel so use red_channel_client_disconnect instead. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
This commit is contained in:
parent
f5aaed38c6
commit
143c5b290f
@ -1027,11 +1027,6 @@ void red_channel_client_default_migrate(RedChannelClient *rcc)
|
||||
red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_MIGRATE);
|
||||
}
|
||||
|
||||
void red_channel_client_destroy(RedChannelClient *rcc)
|
||||
{
|
||||
red_channel_client_disconnect(rcc);
|
||||
}
|
||||
|
||||
void red_channel_client_shutdown(RedChannelClient *rcc)
|
||||
{
|
||||
if (rcc->priv->stream && rcc->priv->stream->watch) {
|
||||
|
||||
@ -35,7 +35,6 @@ SPICE_DECLARE_TYPE(RedChannelClient, red_channel_client, CHANNEL_CLIENT);
|
||||
gboolean red_channel_client_is_connected(RedChannelClient *rcc);
|
||||
void red_channel_client_default_migrate(RedChannelClient *rcc);
|
||||
bool red_channel_client_is_waiting_for_migrate_data(RedChannelClient *rcc);
|
||||
void red_channel_client_destroy(RedChannelClient *rcc);
|
||||
bool red_channel_client_test_remote_common_cap(RedChannelClient *rcc, uint32_t cap);
|
||||
bool red_channel_client_test_remote_cap(RedChannelClient *rcc, uint32_t cap);
|
||||
/* shutdown is the only safe thing to do out of the client/channel
|
||||
|
||||
@ -36,14 +36,14 @@
|
||||
* are deallocated only after red_channel_destroy is called and no RedChannelClient
|
||||
* refers to the channel.
|
||||
* RedChannelClient is created and destroyed by the calls to xxx_channel_client_new
|
||||
* and red_channel_client_destroy. RedChannelClient resources are deallocated only when
|
||||
* and red_channel_client_disconnect. RedChannelClient resources are deallocated only when
|
||||
* its refs == 0. The reference count of RedChannelClient can be increased by routines
|
||||
* that include calls that might destroy the red_channel_client. For example,
|
||||
* red_peer_handle_incoming calls the handle_message proc of the channel, which
|
||||
* might lead to destroying the client. However, after the call to handle_message,
|
||||
* there is a call to the channel's release_msg_buf proc.
|
||||
*
|
||||
* Once red_channel_client_destroy is called, the RedChannelClient is disconnected and
|
||||
* Once red_channel_client_disconnect is called, the RedChannelClient is disconnected and
|
||||
* removed from the RedChannel clients list, but if rcc->refs != 0, it will still hold
|
||||
* a reference to the Channel. The reason for this is that on the one hand RedChannel holds
|
||||
* callbacks that may be still in use by RedChannel, and on the other hand,
|
||||
@ -55,12 +55,8 @@
|
||||
* are associated with it. However, since part of these channel clients may still have
|
||||
* other references, they will not be completely released, until they are dereferenced.
|
||||
*
|
||||
* Note: red_channel_client_destroy is not thread safe, and still it is called from
|
||||
* red_client_destroy (from the client's thread). However, since before this call,
|
||||
* red_client_destroy calls rcc->channel->client_cbs.disconnect(rcc), which is synchronous,
|
||||
* we assume that if the channel is in another thread, it does no longer have references to
|
||||
* this channel client.
|
||||
* If a call to red_channel_client_destroy is made from another location, it must be called
|
||||
* Note: red_channel_client_disconnect is not thread safe.
|
||||
* If a call to red_channel_client_disconnect is made from another location, it must be called
|
||||
* from the channel's thread.
|
||||
*/
|
||||
struct RedChannelPrivate
|
||||
@ -413,7 +409,7 @@ void red_channel_destroy(RedChannel *channel)
|
||||
// prevent future connection
|
||||
reds_unregister_channel(channel->priv->reds, channel);
|
||||
|
||||
red_channel_foreach_client(channel, red_channel_client_destroy);
|
||||
red_channel_foreach_client(channel, red_channel_client_disconnect);
|
||||
g_object_unref(channel);
|
||||
}
|
||||
|
||||
|
||||
@ -133,10 +133,8 @@ bool red_channel_is_waiting_for_migrate_data(RedChannel *channel);
|
||||
/*
|
||||
* the disconnect callback is called from the channel's thread,
|
||||
* i.e., for display channels - red worker thread, for all the other - from the main thread.
|
||||
* RedClient is managed from the main thread. red_channel_client_destroy can be called only
|
||||
* from red_client_destroy.
|
||||
* red_channel_destroy can be called only from channel thread.
|
||||
*/
|
||||
|
||||
void red_channel_destroy(RedChannel *channel);
|
||||
|
||||
/* return true if all the channel clients support the cap */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user