def get_messages_sent_by(self, nodeid): """ Get sniffed messages. Note! This method flushes the message queue so calling this method again will return only the newly logged messages. """ bucket = self._buckets[nodeid] messages = [] while not bucket.empty(): messages.append(bucket.get_nowait()) return message.MessagesSet(messages)
def get_messages_sent_by(self, nodeid): """ Get sniffed messages. Note! This method flushes the message queue so calling this method again will return only the newly logged messages. Args: nodeid (int): node id Returns: MessagesSet: a set with received messages. """ addr = ('127.0.0.1', self.port + nodeid) messages = self.devices[addr]['msgs'] self.devices[addr]['msgs'] = [] return message.MessagesSet(messages)
def get_messages_sent_by(self, nodeid): messages = self._sniffer.get_messages_sent_by(nodeid).messages ret = message.MessagesSet(messages, self.commissioning_messages[nodeid]) self.commissioning_messages[nodeid] = [] return ret