[libvirt] Re: [PATCH 07/12] Domain Events - remote driver

Ben Guthro bguthro at virtualiron.com
Mon Oct 20 14:48:38 UTC 2008

> Just discovered one tiny problem here - need to check 'event' to see
> if the POLLHUP or POLLERR flags are set, and unregister the callback.
> Otherwise if you kill the server, the client will just spin on POLLHUP
> or ERR  forever. Something like this ought todo the trick
>     if (event & (POLLERR | POLLHUP)) {
>          virEventRemoveHandle(fd);
>          return;
>     }

I've been looking over the rest of your changes.
Generally, I agree all these suggestions are good ones...except for the code above

With this code in, I run the following test
1. start libvirtd
2. begin to monitor events with event-test
3. virsh create foo.xml

At this point, the event-test app encounters a HUP, or ERR, and stops monitoring for events - it will only ever get the "Started" event

I handle this in the event-test poll loop via

if ( pfd.revents & POLLHUP ) {
            DEBUG0("Reset by peer");
            return -1;

Is it not a reasonable restriction to require the client app to handle a Hangup?

More information about the libvir-list mailing list