|
|
4c08dd |
From 46c2ce8f1af0170a2c6a335cc743a3ddff2d96d0 Mon Sep 17 00:00:00 2001
|
|
|
4c08dd |
From: Yonit Halperin <yhalperi@redhat.com>
|
|
|
4c08dd |
Date: Thu, 25 Jul 2013 14:25:24 -0400
|
|
|
4c08dd |
Subject: [PATCH 5/8] reds: s/red_client_disconnect/red_channel_client_shutdown
|
|
|
4c08dd |
inside callbacks
|
|
|
4c08dd |
|
|
|
4c08dd |
When we want to disconnect the main channel from a callback, it is
|
|
|
4c08dd |
safer to use red_channel_client_shutdown, instead of directly
|
|
|
4c08dd |
destroying the client. It is also more consistent with how other
|
|
|
4c08dd |
channels treat errors.
|
|
|
4c08dd |
red_channel_client_shutdown will trigger socket error in the main channel.
|
|
|
4c08dd |
Then, main_channel_client_on_disconnect will be called,
|
|
|
4c08dd |
and eventually, main_dispatcher_client_disconnect.
|
|
|
4c08dd |
|
|
|
4c08dd |
I didn't replace calls to reds_disconnect/reds_client_disconnect in
|
|
|
4c08dd |
places where those calls were safe && that might need immediate client
|
|
|
4c08dd |
disconnection.
|
|
|
4c08dd |
---
|
|
|
4c08dd |
server/reds.c | 7 ++++---
|
|
|
4c08dd |
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
4c08dd |
|
|
|
4c08dd |
diff --git a/server/reds.c b/server/reds.c
|
|
|
4c08dd |
index c66ddc4..ae87c90 100644
|
|
|
4c08dd |
--- a/server/reds.c
|
|
|
4c08dd |
+++ b/server/reds.c
|
|
|
4c08dd |
@@ -879,7 +879,8 @@ static void vdi_port_on_free_self_token(void *opaque)
|
|
|
4c08dd |
|
|
|
4c08dd |
static void vdi_port_remove_client(RedClient *client, void *opaque)
|
|
|
4c08dd |
{
|
|
|
4c08dd |
- reds_client_disconnect(client);
|
|
|
4c08dd |
+ red_channel_client_shutdown(main_channel_client_get_base(
|
|
|
4c08dd |
+ red_client_get_main(client)));
|
|
|
4c08dd |
}
|
|
|
4c08dd |
|
|
|
4c08dd |
/****************************************************************************/
|
|
|
4c08dd |
@@ -1009,7 +1010,7 @@ void reds_on_main_agent_start(MainChannelClient *mcc, uint32_t num_tokens)
|
|
|
4c08dd |
|
|
|
4c08dd |
if (!client_added) {
|
|
|
4c08dd |
spice_warning("failed to add client to agent");
|
|
|
4c08dd |
- reds_client_disconnect(rcc->client);
|
|
|
4c08dd |
+ red_channel_client_shutdown(rcc);
|
|
|
4c08dd |
return;
|
|
|
4c08dd |
}
|
|
|
4c08dd |
} else {
|
|
|
4c08dd |
@@ -1126,7 +1127,7 @@ void reds_on_main_agent_data(MainChannelClient *mcc, void *message, size_t size)
|
|
|
4c08dd |
reds_on_main_agent_monitors_config(mcc, message, size);
|
|
|
4c08dd |
return;
|
|
|
4c08dd |
case AGENT_MSG_FILTER_PROTO_ERROR:
|
|
|
4c08dd |
- reds_disconnect();
|
|
|
4c08dd |
+ red_channel_client_shutdown(main_channel_client_get_base(mcc));
|
|
|
4c08dd |
return;
|
|
|
4c08dd |
}
|
|
|
4c08dd |
|
|
|
4c08dd |
--
|
|
|
4c08dd |
1.8.3.1
|
|
|
4c08dd |
|