diff options
Diffstat (limited to 'libvirt-override-virStream.py')
-rw-r--r-- | libvirt-override-virStream.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/libvirt-override-virStream.py b/libvirt-override-virStream.py index f50a7ef..56f1df5 100644 --- a/libvirt-override-virStream.py +++ b/libvirt-override-virStream.py @@ -9,12 +9,18 @@ libvirtmod.virStreamFree(self._o) self._o = None - def eventAddCallback(self, cb, opaque): - """ """ - try: - self.cb = cb - self.opaque = opaque - ret = libvirtmod.virStreamEventAddCallback(self._o, self) - if ret == -1: raise libvirtError ('virStreamEventAddCallback() failed', conn=self._conn) - except AttributeError: - pass + def dispatchStreamEventCallback(self, events, cbData): + """ + Dispatches events to python user's stream event callbacks + """ + cb = cbData["cb"] + opaque = cbData["opaque"] + + cb(self, events, opaque) + return 0 + + def eventAddCallback(self, events, cb, opaque): + self.cb = cb + cbData = {"stream": self, "cb" : cb, "opaque" : opaque} + ret = libvirtmod.virStreamEventAddCallback(self._o, events, cbData) + if ret == -1: raise libvirtError ('virStreamEventAddCallback() failed') |