summaryrefslogtreecommitdiffstats
path: root/server/reds.c
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2011-08-23 14:13:16 +0300
committerAlon Levy <alevy@redhat.com>2011-08-23 18:30:06 +0300
commit1078dc04edc406950e5f6d91bae456411eaa4a47 (patch)
tree659dcfbe4f01365e8430f9bab8ce64e9ed565373 /server/reds.c
parentf15cac7d7d757fed2a8ce36e8800616e905b128c (diff)
downloadspice-1078dc04edc406950e5f6d91bae456411eaa4a47.tar.gz
spice-1078dc04edc406950e5f6d91bae456411eaa4a47.tar.xz
spice-1078dc04edc406950e5f6d91bae456411eaa4a47.zip
server/reds: reds_client_disconnect: remove wrong check for reds_main_channel_connected
The "channel->disconnecting" parameter already protects against recursion. Removed fixed TODOs.
Diffstat (limited to 'server/reds.c')
-rw-r--r--server/reds.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/server/reds.c b/server/reds.c
index f629471b..d140afd4 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -606,18 +606,15 @@ static int reds_main_channel_connected(void)
void reds_client_disconnect(RedClient *client)
{
- // TODO: rename reds_main_channel_connected, or really set main_channel to NULL on disconnect,
- // though still, it is not a reason not to disconnect the rest of the channels
- if (!reds_main_channel_connected() || client->disconnecting) {
- /* case of recursion (main_channel_client_on_disconnect->
- * reds_client_disconnect->red_client_destroy-<main_channel...
- */
+ if (!client || client->disconnecting) {
return;
}
red_printf("");
- // why is "disconnecting" even needed? it is synchronic, even in the dispatcher we are now waiting for disconnection
- // Are there recursive calls? Maybe from main_channel?
+ /* disconnecting is set to prevent recursion because of the following:
+ * main_channel_client_on_disconnect->
+ * reds_client_disconnect->red_client_destroy->main_channel...
+ */
client->disconnecting = TRUE;
// TODO: we need to handle agent properly for all clients!!!! (e.g., cut and paste, how?)
@@ -629,7 +626,6 @@ void reds_client_disconnect(RedClient *client)
// 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)
- // We shouldn't initialize the agent when there are still clients connected
if (reds->num_clients == 0) {
/* Reset write filter to start with clean state on client reconnect */
agent_msg_filter_init(&reds->agent_state.write_filter, agent_copypaste,