Skip to content

Commit 85404f3

Browse files
authored
Fix: use cached port for logging (#1045)
Especially in the error handler, it's worth using the cached port as the underlying socket might already have been close which can lead to errors masking the actual exception that should be surfaced to the user instead.
1 parent 249c10b commit 85404f3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

neo4j/io/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ def _set_defunct(self, message, error=None, silent=False):
588588
direct_driver = isinstance(self.pool, BoltPool)
589589

590590
if error:
591-
log.debug("[#%04X] %r", self.socket.getsockname()[1], error)
591+
log.debug("[#%04X] %r", self.local_port, error)
592592
log.error(message)
593593
# We were attempting to receive data but the connection
594594
# has unexpectedly terminated. So, we need to close the

0 commit comments

Comments
 (0)