Exemple #1
0
    def __Echo(self, dummy, queueop):
        length = random.randint(1, 48)
        data = [chr(random.randint(0, 255)) for x in range(0, length)]
        data = "".join(data)
        queueop.ident = data

        if not self.mdl_echo.write(data):
            # if socket is invalid, would never return feedback
            # so we schedule a clearly invalid "response"
            schedule(0, self.mdlecho_pong, mdl, "")
Exemple #2
0
    def Acquire(self, reply_handler, error_handler):
        if not self.valid:
            raise HealthError("Data channel deleted")

        if self.mdl.active():
            schedule(reply_handler, self.mdl.sk)
            return

            # Pass this closure as reply handler

        def reconnected():
            reply_handler(self.mdl.sk)

        self.device._ReconnectChannel(self, reconnected, error_handler)