Example #1
0
 def fire(self,*args,**kwargs):
     # are we currently firing?
     if not self.firing:
         # keep our events to the side
         self.to_fire.append((args,kwargs))
     else:
         # if we are firing just let'm go
         Eventable.fire(self,*args,**kwargs)
Example #2
0
    def __init__(self,port):
        asyncore.dispatcher.__init__(self)
        Eventable.__init__(self)

        # open a udp socket
        self.create_socket(socket.AF_INET, socket.SOCK_DGRAM)

        # listen on defined port
        log.info('UDPCollector: binding to %s' % port)
        self.bind(('', port))
        self.port = port
Example #3
0
    def fire_events(self):
        # now we actually fire them
        self.firing = True

        for args, kwargs in self.to_fire:
            Eventable.fire(self,*args,**kwargs)

        # reset our to fire
        self.to_fire = []

        # and we're done
        self.firing = False