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.
pull/29420/head
Vasil Dimov 1 year ago
parent 4c526f575c
commit ba621ffb9c
No known key found for this signature in database
GPG Key ID: 54DF06F64B55CBBF

@ -217,7 +217,12 @@ class P2PConnection(asyncio.Protocol):
def connection_made(self, transport):
"""asyncio callback when a connection is opened."""
assert not self._transport
logger.debug("Connected & Listening: %s:%d" % (self.dstaddr, self.dstport))
info = transport.get_extra_info("socket")
us = info.getsockname()
them = info.getpeername()
logger.debug(f"Connected: us={us[0]}:{us[1]}, them={them[0]}:{them[1]}")
self.dstaddr = them[0]
self.dstport = them[1]
self._transport = transport
# in an inbound connection to the TestNode with P2PConnection as the initiator, [TestNode <---- P2PConnection]
# send the initial handshake immediately

Loading…
Cancel
Save