def on_message(self, message):
    'Receive message and dispatch message to appropriate callback.\n\n        We keep a count of how many of each message type has been received\n        and the most recent message of each type.'
    with mininode_lock:
        try:
            command = message.command.decode('ascii')
            self.message_count[command] += 1
            self.last_message[command] = message
            getattr(self, ('on_' + command))(message)
        except:
            print(('ERROR delivering %s (%s)' % (repr(message), sys.exc_info()[0])))
            raise
Receive message and dispatch message to appropriate callback.

We keep a count of how many of each message type has been received
and the most recent message of each type.
def on_message(self, message):
    'Receive message and dispatch message to appropriate callback.\n\n        We keep a count of how many of each message type has been received\n        and the most recent message of each type.'
    with mininode_lock:
        try:
            command = message.command.decode('ascii')
            self.message_count[command] += 1
            self.last_message[command] = message
            getattr(self, ('on_' + command))(message)
        except:
            print(('ERROR delivering %s (%s)' % (repr(message), sys.exc_info()[0])))
            raise