Skip to content
Commit 1c08a117 authored by Jonathon Jongsma's avatar Jonathon Jongsma
Browse files

Add SpiceSession::disconnected signal



Previously, an application was required to determine whether a session
had been disconnected by listening for the SpiceSession::channel-destroy
signal for each individual channel. The Application had to keep track of
whether all channels had been destroyed.

An additional difficulty is that when a SpiceSession::channel-destroy
signal is emitted, the channel object has not been freed yet, so any
shutdown/de-allocation actions have not yet happened. This became
significant since virt-viewer exits the application in response to the
last 'channel-destroy' signal, which means that the channel objects are
never properly freed. This is particularly problematic for the usbredir
channel, which might need to disconnect USB devices asynchronously, and
if the application exits before that process has completed, the USB
devices may not be available on the client machine.

With this patch, the SpiceSession still emits the 'channel-destroy'
signal for each channel when it is disconnected. But it also internally
tracks which channels have been destroyed, and waits for them to be
freed. When all channels are freed, it emits an additional
'disconnected' signal.  An application can be confident that all
channels have been freed by this point, and the application can exit
safely.

Signed-off-by: default avatarJonathon Jongsma <jjongsma@redhat.com>
Acked-by: default avatarMarc-André Lureau <marcandre.lureau@gmail.com>
parent 4b730b1a
Loading
Loading
Loading
Pipeline #773 passed with stage
in 4 minutes and 26 seconds
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment