From 5a755ac30ad0636e17868e19e6d77b41d8be9ff5 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 11 Feb 2020 13:59:09 +1100 Subject: [PATCH] esp32/modsocket: Convert EADDRINUSE error code from lwip return value. --- ports/esp32/modsocket.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ports/esp32/modsocket.c b/ports/esp32/modsocket.c index 60a028c130..be2a749391 100644 --- a/ports/esp32/modsocket.c +++ b/ports/esp32/modsocket.c @@ -155,7 +155,9 @@ void usocket_events_handler(void) { NORETURN static void exception_from_errno(int _errno) { // Here we need to convert from lwip errno values to MicroPython's standard ones - if (_errno == EINPROGRESS) { + if (_errno == EADDRINUSE) { + _errno = MP_EADDRINUSE; + } else if (_errno == EINPROGRESS) { _errno = MP_EINPROGRESS; } mp_raise_OSError(_errno);