Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/mininode.py
Show First 20 Lines • Show All 325 Lines • ▼ Show 20 Lines | def on_message(self, message): | ||||
We keep a count of how many of each message type has been received | We keep a count of how many of each message type has been received | ||||
and the most recent message of each type.""" | and the most recent message of each type.""" | ||||
with mininode_lock: | with mininode_lock: | ||||
try: | try: | ||||
command = message.command.decode('ascii') | command = message.command.decode('ascii') | ||||
self.message_count[command] += 1 | self.message_count[command] += 1 | ||||
self.last_message[command] = message | self.last_message[command] = message | ||||
getattr(self, 'on_' + command)(message) | getattr(self, 'on_' + command)(message) | ||||
except: | except Exception: | ||||
print("ERROR delivering {} ({})".format( | print("ERROR delivering {} ({})".format( | ||||
repr(message), sys.exc_info()[0])) | repr(message), sys.exc_info()[0])) | ||||
raise | raise | ||||
# Callback methods. Can be overridden by subclasses in individual test | # Callback methods. Can be overridden by subclasses in individual test | ||||
# cases to provide custom message handling behaviour. | # cases to provide custom message handling behaviour. | ||||
def on_open(self): | def on_open(self): | ||||
▲ Show 20 Lines • Show All 298 Lines • Show Last 20 Lines |