diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-07-19 09:07:33 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-07-19 09:07:35 -0400 |
commit | e1260a798d107ad7403d117ccc6bbb1ac41960cd (patch) | |
tree | 6992387bfefd974d599c335679d184c2ad4a812e | |
parent | 4a3e8c5aa6a5d8dda15a76d644b2a9f0f40cdec7 (diff) | |
parent | ea5340c9d24b5b59b178c06e7cb25495a282fdd0 (diff) |
Merge #13715: tests: fixes mininode's P2PConnection sending messages on closing transport
ea5340c9d2 tests: fixes mininode's P2PConnection sending messages on closing transport (marcoagner)
Pull request description:
Fixes #13579.
I think one possible solution is to check for [`_transport.is_closing()`](https://docs.python.org/3.4/library/asyncio-protocol.html#asyncio.BaseTransport.is_closing) in the lambda before sending a message (compatible with Python 3.4 too). Let me know if I missed any side effects this introduces.
Tree-SHA512: cab46f81dccfec7b4460fda478a617845564520694449a9e85bf8a5f1e75f35f52cafd7c64966712c3d6c29956344d5a9dbad8851424f061eb3748bc621b900b
-rwxr-xr-x | test/functional/test_framework/mininode.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/functional/test_framework/mininode.py b/test/functional/test_framework/mininode.py index 29bf33fa5b..d5b1a90687 100755 --- a/test/functional/test_framework/mininode.py +++ b/test/functional/test_framework/mininode.py @@ -179,7 +179,7 @@ class P2PConnection(asyncio.Protocol): raise IOError('Not connected') self._log_message("send", message) tmsg = self._build_message(message) - NetworkThread.network_event_loop.call_soon_threadsafe(lambda: self._transport and self._transport.write(tmsg)) + NetworkThread.network_event_loop.call_soon_threadsafe(lambda: self._transport and not self._transport.is_closing() and self._transport.write(tmsg)) # Class utility methods |