mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
Refactor code for enabling/disabling I/O callback in remote client
* src/rpc/virnetclient.c: Add helper for setting I/O callback events
This commit is contained in:
parent
5990f227e9
commit
b196220337
@ -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
|
||||
*
|
||||
@ -1284,12 +1295,12 @@ static int virNetClientIO(virNetClientPtr client,
|
||||
* cause the event loop thread to be blocked on the
|
||||
* mutex for the duration of the call
|
||||
*/
|
||||
virNetSocketUpdateIOCallback(client->sock, 0);
|
||||
virNetClientIOUpdateCallback(client, false);
|
||||
|
||||
virResetLastError();
|
||||
rv = virNetClientIOEventLoop(client, thiscall);
|
||||
|
||||
virNetSocketUpdateIOCallback(client->sock, VIR_EVENT_HANDLE_READABLE);
|
||||
virNetClientIOUpdateCallback(client, true);
|
||||
|
||||
if (rv == 0 &&
|
||||
virGetLastError())
|
||||
|
Loading…
Reference in New Issue
Block a user