aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/test_framework/mininode.py
diff options
context:
space:
mode:
authorPatrick Lodder <[email protected]>2021-08-17 00:42:58 +0200
committerPatrick Lodder <[email protected]>2021-08-17 20:15:30 +0200
commitcaf26b77ab880ecce2ef1eae50cd863ec9d3a52b (patch)
tree7bb18b1bcb87b9fcdb448ca29db53486f82614ee /qa/rpc-tests/test_framework/mininode.py
parentp2p-acceptblock: add steps 8, 9 to confirm node disconnects (diff)
downloadarchived-discoin-caf26b77ab880ecce2ef1eae50cd863ec9d3a52b.tar.xz
archived-discoin-caf26b77ab880ecce2ef1eae50cd863ec9d3a52b.zip
fixup p2p-acceptblock and mininode to test disconnects
without partially backporting a new testframework. - Adds a condition to NodeConn that when asyncore calls handle_read without any data, this must be a disconnect and closes the socket - Adds a little loop in the p2p-acceptblock client that waits for the socket to be in a closed state - Makes expected disconnects non-optional in p2p-acceptblock - Syncs the test descriptions and outputs with reality
Diffstat (limited to 'qa/rpc-tests/test_framework/mininode.py')
-rwxr-xr-xqa/rpc-tests/test_framework/mininode.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/qa/rpc-tests/test_framework/mininode.py b/qa/rpc-tests/test_framework/mininode.py
index 1520e6754..964e98a1c 100755
--- a/qa/rpc-tests/test_framework/mininode.py
+++ b/qa/rpc-tests/test_framework/mininode.py
@@ -1684,6 +1684,10 @@ class NodeConn(asyncore.dispatcher):
if len(t) > 0:
self.recvbuf += t
self.got_data()
+ else:
+ self.show_debug_msg("MiniNode: Closing connection to %s:%d after peer disconnect..."
+ % (self.dstaddr, self.dstport))
+ self.handle_close()
except:
pass