diff options
Diffstat (limited to 'Modules')
| -rw-r--r-- | Modules/socketmodule.c | 2 | ||||
| -rw-r--r-- | Modules/socketmodule.h | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 3fca9f6851..fbdd1a164d 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -7933,7 +7933,7 @@ PyInit__socket(void) #ifdef IPPROTO_VRRP PyModule_AddIntMacro(m, IPPROTO_VRRP); #endif -#if defined(IPPROTO_SCTP) && !defined(__EMSCRIPTEN__) +#ifdef IPPROTO_SCTP PyModule_AddIntMacro(m, IPPROTO_SCTP); #endif #ifdef IPPROTO_BIP diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h index db26c046c3..1b35b11cde 100644 --- a/Modules/socketmodule.h +++ b/Modules/socketmodule.h @@ -192,6 +192,21 @@ typedef int socklen_t; #endif /* HAVE_SOCKADDR_ALG */ +#ifdef __EMSCRIPTEN__ +// wasm32-emscripten sockets only support subset of IPv4 and IPv6. +// SCTP protocol crashes runtime. +#ifdef IPPROTO_SCTP +# undef IPPROTO_SCTP +#endif +// setsockopt() fails with ENOPROTOOPT, getsockopt only supports SO_ERROR. +// undef SO_REUSEADDR and SO_REUSEPORT so they cannot be used. +#ifdef SO_REUSEADDR +# undef SO_REUSEADDR +#endif +#ifdef SO_REUSEPORT +# undef SO_REUSEPORT +#endif +#endif // __EMSCRIPTEN__ #ifndef Py__SOCKET_H #define Py__SOCKET_H |
