Translate CRE's due to socket-close to tpt-closed
Just like in the BRE case (for UDS) it seems when a peer closes the (UDS?) socket `trio` instead raises a `ClosedResourceError` which we now catch and re-raise as a `TransportClosed`. This again results in `tpt.send()` calls from the rpc-runtime **not** raising when it's known that the IPC channel is disconnected.main
parent
a72d1e6c48
commit
df0d00abf4
|
@ -430,6 +430,7 @@ class MsgpackTransport(MsgTransport):
|
||||||
return await self.stream.send_all(size + bytes_data)
|
return await self.stream.send_all(size + bytes_data)
|
||||||
except (
|
except (
|
||||||
trio.BrokenResourceError,
|
trio.BrokenResourceError,
|
||||||
|
trio.ClosedResourceError,
|
||||||
) as _re:
|
) as _re:
|
||||||
trans_err = _re
|
trans_err = _re
|
||||||
tpt_name: str = f'{type(self).__name__!r}'
|
tpt_name: str = f'{type(self).__name__!r}'
|
||||||
|
@ -458,6 +459,22 @@ class MsgpackTransport(MsgTransport):
|
||||||
)
|
)
|
||||||
raise tpt_closed from trans_err
|
raise tpt_closed from trans_err
|
||||||
|
|
||||||
|
case trio.ClosedResourceError() if (
|
||||||
|
'this socket was already closed'
|
||||||
|
in
|
||||||
|
trans_err.args[0]
|
||||||
|
):
|
||||||
|
tpt_closed = TransportClosed.from_src_exc(
|
||||||
|
message=(
|
||||||
|
f'{tpt_name} already closed by peer\n'
|
||||||
|
),
|
||||||
|
body=f'{self}\n',
|
||||||
|
src_exc=trans_err,
|
||||||
|
raise_on_report=True,
|
||||||
|
loglevel='transport',
|
||||||
|
)
|
||||||
|
raise tpt_closed from trans_err
|
||||||
|
|
||||||
# unless the disconnect condition falls under "a
|
# unless the disconnect condition falls under "a
|
||||||
# normal operation breakage" we usualy console warn
|
# normal operation breakage" we usualy console warn
|
||||||
# about it.
|
# about it.
|
||||||
|
|
Loading…
Reference in New Issue