Skip to content

Commit e1260a7

Browse files
author
MarcoFalke
committed
Merge #13715: tests: fixes mininode's P2PConnection sending messages on closing transport
ea5340c 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
2 parents 4a3e8c5 + ea5340c commit e1260a7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/functional/test_framework/mininode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def send_message(self, message):
179179
raise IOError('Not connected')
180180
self._log_message("send", message)
181181
tmsg = self._build_message(message)
182-
NetworkThread.network_event_loop.call_soon_threadsafe(lambda: self._transport and self._transport.write(tmsg))
182+
NetworkThread.network_event_loop.call_soon_threadsafe(lambda: self._transport and not self._transport.is_closing() and self._transport.write(tmsg))
183183

184184
# Class utility methods
185185

0 commit comments

Comments
 (0)