@@ -1458,9 +1458,7 @@ class NodeConnCB():
14581458 """Callback and helper functions for P2P connection to a bitcoind node.
14591459
14601460 Individual testcases should subclass this and override the on_* methods
1461- if they want to alter message handling behaviour.
1462- """
1463-
1461+ if they want to alter message handling behaviour."""
14641462 def __init__ (self ):
14651463 # Track whether we have a P2P connection open to the node
14661464 self .connected = False
@@ -1474,25 +1472,13 @@ def __init__(self):
14741472 # A count of the number of ping messages we've sent to the node
14751473 self .ping_counter = 1
14761474
1477- # deliver_sleep_time is helpful for debugging race conditions in p2p
1478- # tests; it causes message delivery to sleep for the specified time
1479- # before acquiring the global lock and delivering the next message.
1480- self .deliver_sleep_time = None
1481-
14821475 # Message receiving methods
14831476
14841477 def deliver (self , conn , message ):
14851478 """Receive message and dispatch message to appropriate callback.
14861479
14871480 We keep a count of how many of each message type has been received
1488- and the most recent message of each type.
1489-
1490- Optionally waits for deliver_sleep_time before dispatching message.
1491- """
1492-
1493- deliver_sleep = self .get_deliver_sleep_time ()
1494- if deliver_sleep is not None :
1495- time .sleep (deliver_sleep )
1481+ and the most recent message of each type."""
14961482 with mininode_lock :
14971483 try :
14981484 command = message .command .decode ('ascii' )
@@ -1504,10 +1490,6 @@ def deliver(self, conn, message):
15041490 sys .exc_info ()[0 ]))
15051491 raise
15061492
1507- def get_deliver_sleep_time (self ):
1508- with mininode_lock :
1509- return self .deliver_sleep_time
1510-
15111493 # Callback methods. Can be overridden by subclasses in individual test
15121494 # cases to provide custom message handling behaviour.
15131495
@@ -1616,9 +1598,10 @@ def sync_with_ping(self, timeout=60):
16161598 wait_until (test_function , timeout = timeout , lock = mininode_lock )
16171599 self .ping_counter += 1
16181600
1619- # The actual NodeConn class
1620- # This class provides an interface for a p2p connection to a specified node
16211601class NodeConn (asyncore .dispatcher ):
1602+ """The actual NodeConn class
1603+
1604+ This class provides an interface for a p2p connection to a specified node."""
16221605 messagemap = {
16231606 b"version" : msg_version ,
16241607 b"verack" : msg_verack ,
@@ -1838,13 +1821,3 @@ def run(self):
18381821 [ obj .handle_close () for obj in disconnected ]
18391822 asyncore .loop (0.1 , use_poll = True , map = mininode_socket_map , count = 1 )
18401823 logger .debug ("Network thread closing" )
1841-
1842-
1843- # An exception we can raise if we detect a potential disconnect
1844- # (p2p or rpc) before the test is complete
1845- class EarlyDisconnectError (Exception ):
1846- def __init__ (self , value ):
1847- self .value = value
1848-
1849- def __str__ (self ):
1850- return repr (self .value )
0 commit comments