|
Daniel P. Berrange |
511f6c |
From: Daniel P. Berrange <berrange@redhat.com>
|
|
Daniel P. Berrange |
511f6c |
Date: Mon, 16 Mar 2009 10:35:21 +0000 (+0000)
|
|
Daniel P. Berrange |
511f6c |
Subject: Fix dispatch of FD events when one or more handles are marked deleted
|
|
Daniel P. Berrange |
511f6c |
X-Git-Url: http://git.et.redhat.com/?p=libvirt.git;a=commitdiff_plain;h=10baf3deb8588f5902b6f2eb362fb408707e3d95
|
|
Daniel P. Berrange |
511f6c |
|
|
Daniel P. Berrange |
511f6c |
Fix dispatch of FD events when one or more handles are marked deleted
|
|
Daniel P. Berrange |
511f6c |
---
|
|
Daniel P. Berrange |
511f6c |
|
|
Daniel P. Berrange |
511f6c |
diff --git a/qemud/event.c b/qemud/event.c
|
|
Daniel P. Berrange |
511f6c |
index c9ea563..0887008 100644
|
|
Daniel P. Berrange |
511f6c |
--- a/qemud/event.c
|
|
Daniel P. Berrange |
511f6c |
+++ b/qemud/event.c
|
|
Daniel P. Berrange |
511f6c |
@@ -409,25 +409,26 @@ static int virEventDispatchTimeouts(void) {
|
|
Daniel P. Berrange |
511f6c |
* Returns 0 upon success, -1 if an error occurred
|
|
Daniel P. Berrange |
511f6c |
*/
|
|
Daniel P. Berrange |
511f6c |
static int virEventDispatchHandles(int nfds, struct pollfd *fds) {
|
|
Daniel P. Berrange |
511f6c |
- int i;
|
|
Daniel P. Berrange |
511f6c |
+ int i, n;
|
|
Daniel P. Berrange |
511f6c |
|
|
Daniel P. Berrange |
511f6c |
- for (i = 0 ; i < nfds ; i++) {
|
|
Daniel P. Berrange |
511f6c |
+ for (i = 0, n = 0 ; i < eventLoop.handlesCount && n < nfds ; i++) {
|
|
Daniel P. Berrange |
511f6c |
if (eventLoop.handles[i].deleted) {
|
|
Daniel P. Berrange |
511f6c |
EVENT_DEBUG("Skip deleted %d", eventLoop.handles[i].fd);
|
|
Daniel P. Berrange |
511f6c |
continue;
|
|
Daniel P. Berrange |
511f6c |
}
|
|
Daniel P. Berrange |
511f6c |
|
|
Daniel P. Berrange |
511f6c |
- if (fds[i].revents) {
|
|
Daniel P. Berrange |
511f6c |
+ if (fds[n].revents) {
|
|
Daniel P. Berrange |
511f6c |
virEventHandleCallback cb = eventLoop.handles[i].cb;
|
|
Daniel P. Berrange |
511f6c |
void *opaque = eventLoop.handles[i].opaque;
|
|
Daniel P. Berrange |
511f6c |
- int hEvents = virPollEventToEventHandleType(fds[i].revents);
|
|
Daniel P. Berrange |
511f6c |
- EVENT_DEBUG("Dispatch %d %d %p", fds[i].fd,
|
|
Daniel P. Berrange |
511f6c |
- fds[i].revents, eventLoop.handles[i].opaque);
|
|
Daniel P. Berrange |
511f6c |
+ int hEvents = virPollEventToEventHandleType(fds[n].revents);
|
|
Daniel P. Berrange |
511f6c |
+ EVENT_DEBUG("Dispatch %d %d %p", fds[n].fd,
|
|
Daniel P. Berrange |
511f6c |
+ fds[n].revents, eventLoop.handles[i].opaque);
|
|
Daniel P. Berrange |
511f6c |
virEventUnlock();
|
|
Daniel P. Berrange |
511f6c |
(cb)(eventLoop.handles[i].watch,
|
|
Daniel P. Berrange |
511f6c |
- fds[i].fd, hEvents, opaque);
|
|
Daniel P. Berrange |
511f6c |
+ fds[n].fd, hEvents, opaque);
|
|
Daniel P. Berrange |
511f6c |
virEventLock();
|
|
Daniel P. Berrange |
511f6c |
}
|
|
Daniel P. Berrange |
511f6c |
+ n++;
|
|
Daniel P. Berrange |
511f6c |
}
|
|
Daniel P. Berrange |
511f6c |
|
|
Daniel P. Berrange |
511f6c |
return 0;
|