From 3c3bbeff3418c60b14f793a6541ad01d8036b706 Mon Sep 17 00:00:00 2001 From: jensbjorgensen Date: Mon, 26 Aug 2024 15:04:49 -0500 Subject: [PATCH] udp errors should result in protocol.error_received (#601) --- uvloop/handles/udp.pyx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/uvloop/handles/udp.pyx b/uvloop/handles/udp.pyx index bbe60d56..ef20c3f7 100644 --- a/uvloop/handles/udp.pyx +++ b/uvloop/handles/udp.pyx @@ -244,16 +244,15 @@ cdef class UDPTransport(UVBaseTransport): ctx.close() exc = convert_error(err) - self._fatal_error(exc, True) + if isinstance(exc, OSError): + run_in_context1(self.context.copy(), self._protocol.error_received, exc) + else: + self._fatal_error(exc, True) else: self._maybe_pause_protocol() else: - if err < 0: - exc = convert_error(err) - self._fatal_error(exc, True) - else: - self._on_sent(None, self.context.copy()) + self._on_sent(convert_error(err) if err < 0 else None, self.context.copy()) cdef _on_receive(self, bytes data, object exc, object addr): if exc is None: