def __init__(self, address): self.client = Client(address) # Set up the handlers self.proto = protocol.get() for x in filter(lambda y: y.mtype == protocol.server, self.proto.values()): x.handler = self.__getattribute__('_%s_handler' % x.name) self.client.on_data += self.data_handler self._retrieve_events()
def __init__(self, port, max_conns): self.server = Server(port, max_conns) self.server.on_data += self._data_handler self.server.on_cleanup += self._clean_contact self.subscribers = {} self.properties = {} self._properties_lock = Lock() self._subscriber_lock = Lock() self._updated_properties = set() # Update Vars self._last_update = datetime.now() self._updating = False self._update_lock = Lock() # Handlers self.proto = protocol.get() for x in filter(lambda y: y.mtype == protocol.client, self.proto.values()): x.handler = self.__getattribute__('_%s_handler' % x.name)