From 864f8d267363f06d709f7d53a04efef02adf58bc Mon Sep 17 00:00:00 2001 From: Israel Lot Date: Tue, 12 Mar 2019 18:24:22 -0500 Subject: [PATCH] Don't treat unsupported protocols as fatal errors --- src/Win32_Interop/Win32_Error.h | 5 +++++ src/server.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/Win32_Interop/Win32_Error.h b/src/Win32_Interop/Win32_Error.h index f7130fd1..c3c9d80c 100644 --- a/src/Win32_Interop/Win32_Error.h +++ b/src/Win32_Interop/Win32_Error.h @@ -30,6 +30,10 @@ extern "C" { #endif +#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT /* Socket type not supported */ +#define EPFNOSUPPORT WSAEPFNOSUPPORT /* Protocol family not supported */ + + /* Converts error codes returned by GetLastError/WSAGetLastError to errno codes */ int translate_sys_error(int sys_error); void set_errno_from_last_error(); @@ -37,6 +41,7 @@ void set_errno_from_last_error(); int strerror_r(int err, char* buf, size_t buflen); char *wsa_strerror(int err); + #ifdef __cplusplus } #endif diff --git a/src/server.c b/src/server.c index 96013764..0b913c1b 100644 --- a/src/server.c +++ b/src/server.c @@ -1830,6 +1830,10 @@ int listenToPort(int port, int *fds, int *count) { "Creating Server TCP listening socket %s:%d: %s", server.bindaddr[j] ? server.bindaddr[j] : "*", port, server.neterr); + if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || + errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || + errno == EAFNOSUPPORT || errno == EADDRNOTAVAIL) + continue; return C_ERR; } anetNonBlock(NULL, fds[*count]);