Multi-line-style up the UDS fast-connect handler
Shift around comments and expressions for better reading, assign `tpt_closed` for easier introspection from REPL during debug oh and fix the `MsgpackTransport.pformat()` to render '|_peers: 1' .. XDfinal_eg_refinements
parent
dd23ef1d95
commit
b485297411
|
@ -430,20 +430,24 @@ class MsgpackTransport(MsgTransport):
|
|||
return await self.stream.send_all(size + bytes_data)
|
||||
except (
|
||||
trio.BrokenResourceError,
|
||||
) as bre:
|
||||
trans_err = bre
|
||||
) as _re:
|
||||
trans_err = _re
|
||||
tpt_name: str = f'{type(self).__name__!r}'
|
||||
|
||||
match trans_err:
|
||||
case trio.BrokenResourceError() if (
|
||||
'[Errno 32] Broken pipe' in trans_err.args[0]
|
||||
# ^XXX, specifc to UDS transport and its,
|
||||
|
||||
# XXX, specifc to UDS transport and its,
|
||||
# well, "speediness".. XD
|
||||
# |_ likely todo with races related to how fast
|
||||
# the socket is setup/torn-down on linux
|
||||
# as it pertains to rando pings from the
|
||||
# `.discovery` subsys and protos.
|
||||
case trio.BrokenResourceError() if (
|
||||
'[Errno 32] Broken pipe'
|
||||
in
|
||||
trans_err.args[0]
|
||||
):
|
||||
raise TransportClosed.from_src_exc(
|
||||
tpt_closed = TransportClosed.from_src_exc(
|
||||
message=(
|
||||
f'{tpt_name} already closed by peer\n'
|
||||
),
|
||||
|
@ -451,14 +455,15 @@ class MsgpackTransport(MsgTransport):
|
|||
src_exc=trans_err,
|
||||
raise_on_report=True,
|
||||
loglevel='transport',
|
||||
) from bre
|
||||
)
|
||||
raise tpt_closed from trans_err
|
||||
|
||||
# unless the disconnect condition falls under "a
|
||||
# normal operation breakage" we usualy console warn
|
||||
# about it.
|
||||
case _:
|
||||
log.exception(
|
||||
'{tpt_name} layer failed pre-send ??\n'
|
||||
f'{tpt_name} layer failed pre-send ??\n'
|
||||
)
|
||||
raise trans_err
|
||||
|
||||
|
@ -503,7 +508,7 @@ class MsgpackTransport(MsgTransport):
|
|||
def pformat(self) -> str:
|
||||
return (
|
||||
f'<{type(self).__name__}(\n'
|
||||
f' |_peers: 2\n'
|
||||
f' |_peers: 1\n'
|
||||
f' laddr: {self._laddr}\n'
|
||||
f' raddr: {self._raddr}\n'
|
||||
# f'\n'
|
||||
|
|
Loading…
Reference in New Issue