提交 b1962203 编写于 作者: D Daniel P. Berrange

Refactor code for enabling/disabling I/O callback in remote client

* src/rpc/virnetclient.c: Add helper for setting I/O callback events
上级 5990f227
...@@ -1176,6 +1176,17 @@ error: ...@@ -1176,6 +1176,17 @@ error:
} }
static void virNetClientIOUpdateCallback(virNetClientPtr client,
bool enableCallback)
{
int events = 0;
if (enableCallback)
events |= VIR_EVENT_HANDLE_READABLE;
virNetSocketUpdateIOCallback(client->sock, events);
}
/* /*
* This function sends a message to remote server and awaits a reply * This function sends a message to remote server and awaits a reply
* *
...@@ -1284,12 +1295,12 @@ static int virNetClientIO(virNetClientPtr client, ...@@ -1284,12 +1295,12 @@ static int virNetClientIO(virNetClientPtr client,
* cause the event loop thread to be blocked on the * cause the event loop thread to be blocked on the
* mutex for the duration of the call * mutex for the duration of the call
*/ */
virNetSocketUpdateIOCallback(client->sock, 0); virNetClientIOUpdateCallback(client, false);
virResetLastError(); virResetLastError();
rv = virNetClientIOEventLoop(client, thiscall); rv = virNetClientIOEventLoop(client, thiscall);
virNetSocketUpdateIOCallback(client->sock, VIR_EVENT_HANDLE_READABLE); virNetClientIOUpdateCallback(client, true);
if (rv == 0 && if (rv == 0 &&
virGetLastError()) virGetLastError())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册