mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-01 13:10:43 +00:00
Add red_channel_client_(set|is)_destroying()
Encapsulate the structure a bit more and avoid poking into it from other class implementations. Getting ready to split RedChannelClient out to a separate file.
This commit is contained in:
parent
2fa1c1e3fd
commit
7b8087a71d
@ -2111,7 +2111,7 @@ void red_client_destroy(RedClient *client)
|
||||
// is not synchronous.
|
||||
rcc = link->data;
|
||||
channel = red_channel_client_get_channel(rcc);
|
||||
rcc->destroying = 1;
|
||||
red_channel_client_set_destroying(rcc);
|
||||
// some channels may be in other threads. However we currently
|
||||
// assume disconnect is synchronous (we changed the dispatcher
|
||||
// to wait for disconnection)
|
||||
@ -2448,3 +2448,13 @@ RedChannel* red_channel_client_get_channel(RedChannelClient *rcc)
|
||||
{
|
||||
return rcc->channel;
|
||||
}
|
||||
|
||||
gboolean red_channel_client_is_destroying(RedChannelClient *rcc)
|
||||
{
|
||||
return rcc->destroying;
|
||||
}
|
||||
|
||||
void red_channel_client_set_destroying(RedChannelClient *rcc)
|
||||
{
|
||||
rcc->destroying = TRUE;
|
||||
}
|
||||
|
||||
@ -629,5 +629,7 @@ int red_channel_wait_all_sent(RedChannel *channel,
|
||||
int64_t timeout);
|
||||
void red_channel_client_disconnect_if_pending_send(RedChannelClient *rcc);
|
||||
RedChannel* red_channel_client_get_channel(RedChannelClient *rcc);
|
||||
gboolean red_channel_client_is_destroying(RedChannelClient *rcc);
|
||||
void red_channel_client_set_destroying(RedChannelClient *rcc);
|
||||
|
||||
#endif
|
||||
|
||||
@ -306,7 +306,7 @@ static void spicevmc_red_channel_client_on_disconnect(RedChannelClient *rcc)
|
||||
|
||||
/* Don't destroy the rcc if it is already being destroyed, as then
|
||||
red_client_destroy/red_channel_client_destroy will already do this! */
|
||||
if (!rcc->destroying)
|
||||
if (!red_channel_client_is_destroying(rcc))
|
||||
red_channel_client_destroy(rcc);
|
||||
|
||||
state->rcc = NULL;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user