Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/mininode.py
Show First 20 Lines • Show All 1,706 Lines • ▼ Show 20 Lines | class NodeConnCB(): | ||||
# Sync up with the node | # Sync up with the node | ||||
def sync_with_ping(self, timeout=60): | def sync_with_ping(self, timeout=60): | ||||
self.send_message(msg_ping(nonce=self.ping_counter)) | self.send_message(msg_ping(nonce=self.ping_counter)) | ||||
def test_function(): return self.last_message.get( | def test_function(): return self.last_message.get( | ||||
"pong") and self.last_message["pong"].nonce == self.ping_counter | "pong") and self.last_message["pong"].nonce == self.ping_counter | ||||
assert wait_until(test_function, timeout=timeout) | assert wait_until(test_function, timeout=timeout) | ||||
self.ping_counter += 1 | self.ping_counter += 1 | ||||
return True | |||||
# The actual NodeConn class | # The actual NodeConn class | ||||
# This class provides an interface for a p2p connection to a specified node | # This class provides an interface for a p2p connection to a specified node | ||||
class NodeConn(asyncore.dispatcher): | class NodeConn(asyncore.dispatcher): | ||||
messagemap = { | messagemap = { | ||||
b"version": msg_version, | b"version": msg_version, | ||||
▲ Show 20 Lines • Show All 226 Lines • Show Last 20 Lines |