On Wed, May 17, 2017 at 03:49:45PM +0200, Daniel Kučera wrote:
> No, I'm not, I'm calling it sooner:
>
> func libvirt_start() {
> libvirt.EventRegisterDefaultImpl() Well the following example works as expected for me
> event_listen()
> }
package main
import (
"github.com/libvirt/libvirt-go"
"log"
)
func libvirt_close_callback(conn *libvirt.Connect, reason libvirt.ConnectCloseReason) {
log.Printf("In here")
}
func main() {
libvirt.EventRegisterDefaultImpl()
hv, err := libvirt.NewConnect("qemu:///session")
err = hv.RegisterCloseCallback(libvirt_close_callback) for {
if err != nil {
log.Printf("unable to register close callback")
return
}
libvirt.EventRunDefaultImpl()
}
}
Printing out "In here" immediately when I kill libvirtd
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|