feat: implement get_remote_address via delegation pattern

This commit is contained in:
acul71
2025-03-13 14:08:13 +01:00
committed by Paul Robinson
parent 798229cd3a
commit fabf2cefc4
8 changed files with 72 additions and 1 deletions

View File

@ -365,3 +365,7 @@ class Mplex(IMuxedConn):
await send_channel.aclose()
self.event_closed.set()
await self.new_stream_send_channel.aclose()
def get_remote_address(self) -> Optional[tuple[str, int]]:
"""Delegate to the underlying Mplex connection's secured_conn."""
return self.secured_conn.get_remote_address()

View File

@ -1,5 +1,6 @@
from typing import (
TYPE_CHECKING,
Optional,
)
import trio
@ -252,3 +253,7 @@ class MplexStream(IMuxedStream):
"""
self.write_deadline = ttl
return True
def get_remote_address(self) -> Optional[tuple[str, int]]:
"""Delegate to the parent Mplex connection."""
return self.muxed_conn.get_remote_address()