Skip to content

Commit ba621ff

Browse files
committed
test: improve debug log message from P2PConnection::connection_made()
This is used in both cases - TCP server (accept) and TCP client (connect). The message "Connected & Listening address:port" is confusing. Print both ends of the TCP connection.
1 parent 4c526f5 commit ba621ff

File tree

1 file changed

+6
-1
lines changed
  • test/functional/test_framework

1 file changed

+6
-1
lines changed

test/functional/test_framework/p2p.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,12 @@ def peer_disconnect(self):
217217
def connection_made(self, transport):
218218
"""asyncio callback when a connection is opened."""
219219
assert not self._transport
220-
logger.debug("Connected & Listening: %s:%d" % (self.dstaddr, self.dstport))
220+
info = transport.get_extra_info("socket")
221+
us = info.getsockname()
222+
them = info.getpeername()
223+
logger.debug(f"Connected: us={us[0]}:{us[1]}, them={them[0]}:{them[1]}")
224+
self.dstaddr = them[0]
225+
self.dstport = them[1]
221226
self._transport = transport
222227
# in an inbound connection to the TestNode with P2PConnection as the initiator, [TestNode <---- P2PConnection]
223228
# send the initial handshake immediately

0 commit comments

Comments
 (0)