This functionality is to be extended, simple call to g_main_loop_quit()
is not enough. In order to make changes convinient, the helper is
required.
Signed-off-by: Denis V. Lunev <den(a)openvz.org>
---
src/rpc/virnetclient.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index d29917df27..d9a508246f 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -150,6 +150,13 @@ void virNetClientSetCloseCallback(virNetClient *client,
}
+static void
+virNetClientIOWakeup(virNetClient *client)
+{
+ g_main_loop_quit(client->eventLoop);
+}
+
+
static void virNetClientIncomingEvent(virNetSocket *sock,
int events,
void *opaque);
@@ -851,7 +858,7 @@ static void virNetClientCloseInternal(virNetClient *client,
* queue and close the client because we set client->wantClose.
*/
if (client->haveTheBuck) {
- g_main_loop_quit(client->eventLoop);
+ virNetClientIOWakeup(client);
} else {
virNetClientIOEventLoopPassTheBuck(client, NULL);
}
@@ -918,7 +925,7 @@ virNetClientIOEventTLS(int fd G_GNUC_UNUSED,
virNetClient *client = opaque;
if (!virNetClientTLSHandshake(client))
- g_main_loop_quit(client->eventLoop);
+ virNetClientIOWakeup(client);
return G_SOURCE_REMOVE;
}
@@ -931,7 +938,7 @@ virNetClientIOEventTLSConfirm(int fd G_GNUC_UNUSED,
{
virNetClient *client = opaque;
- g_main_loop_quit(client->eventLoop);
+ virNetClientIOWakeup(client);
return G_SOURCE_REMOVE;
}
@@ -1675,7 +1682,7 @@ virNetClientIOEventFD(int fd G_GNUC_UNUSED,
{
struct virNetClientIOEventData *data = opaque;
data->rev = ev;
- g_main_loop_quit(data->client->eventLoop);
+ virNetClientIOWakeup(data->client);
return G_SOURCE_REMOVE;
}
@@ -2006,8 +2013,7 @@ static int virNetClientIO(virNetClient *client,
/* Check to see if another thread is dispatching */
if (client->haveTheBuck) {
- /* Force other thread to wakeup from poll */
- g_main_loop_quit(client->eventLoop);
+ virNetClientIOWakeup(client);
/* If we are non-blocking, detach the thread and keep the call in the
* queue. */
--
2.34.1