summaryrefslogtreecommitdiffstats
path: root/spice-common
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2013-09-11 15:02:23 -0400
committerYonit Halperin <yhalperi@redhat.com>2013-09-26 13:58:43 -0400
commit90a4761249f84421b27d67a85262b1423b24fe04 (patch)
tree5cb08ac98307d8408dd3ba082e297c2ac2e92fec /spice-common
parentbcf9e64f134a6073c1e404efc8892c1cb453bd8a (diff)
downloadspice-90a4761249f84421b27d67a85262b1423b24fe04.tar.gz
spice-90a4761249f84421b27d67a85262b1423b24fe04.tar.xz
spice-90a4761249f84421b27d67a85262b1423b24fe04.zip
red_worker: disconnect the channel instead of shutdown in case of a blocking method failure
rhbz#1004443 The methods that trigger waitings on the client pipe require that the waiting will succeed in order to continue, or otherwise, that all the living pipe items will be released (e.g., when we must destroy a surface, we need that all its related pipe items will be released). Shutdown of the socket will eventually trigger red_channel_client_disconnect (*), which will empty the pipe. However, if the blocking method failed, we need to empty the pipe synchronously. It is not safe(**) to call red_channel_client_disconnect from ChannelCbs , but all the blocking calls in red_worker are done from callbacks that are triggered from the device. To summarize, calling red_channel_client_disconnect instead of calling red_channel_client_shutdown will immediately release all the pipe items that are held by the channel client (by calling red_channel_client_pipe_clear). If red_clear_surface_drawables_from_pipe timeouts, red_channel_client_disconnect will make sure that the surface we wish to release is not referenced by any pipe-item. (*) After a shutdown of a socket, we expect that later, when red_peer_handle_incoming is called, it will encounter a socket error and will call the channel's on_error callback which calls red_channel_client_disconnect. (**) I believe it was not safe before commit 2d2121a17038bc0 (before adding ref count to ChannelClient). However, I think it might still be unsafe, because red_channel_client_disconnect sets rcc->stream to NULL, and rcc->stream may be referred later inside a red_channel_client method unsafely. So instead of checking if (stream != NULL) after calling callbacks, we try to avoid calling red_channel_client_disconnect from callbacks.
Diffstat (limited to 'spice-common')
0 files changed, 0 insertions, 0 deletions