diff --git a/asio/include/asio/detail/impl/descriptor_ops.ipp b/asio/include/asio/detail/impl/descriptor_ops.ipp index 9e88ab502d..0122027151 100644 --- a/asio/include/asio/detail/impl/descriptor_ops.ipp +++ b/asio/include/asio/detail/impl/descriptor_ops.ipp @@ -57,14 +57,14 @@ int close(int d, state_type& state, asio::error_code& ec) // current OS where this behaviour is seen, Windows, says that the socket // remains open. Therefore we'll put the descriptor back into blocking // mode and have another attempt at closing it. -#if defined(__SYMBIAN32__) +#if defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) int flags = ::fcntl(d, F_GETFL, 0); if (flags >= 0) ::fcntl(d, F_SETFL, flags & ~O_NONBLOCK); -#else // defined(__SYMBIAN32__) +#else // defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) ioctl_arg_type arg = 0; ::ioctl(d, FIONBIO, &arg); -#endif // defined(__SYMBIAN32__) +#endif // defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) state &= ~non_blocking; errno = 0; @@ -87,7 +87,7 @@ bool set_user_non_blocking(int d, state_type& state, } errno = 0; -#if defined(__SYMBIAN32__) +#if defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) int result = error_wrapper(::fcntl(d, F_GETFL, 0), ec); if (result >= 0) { @@ -95,10 +95,10 @@ bool set_user_non_blocking(int d, state_type& state, int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK)); result = error_wrapper(::fcntl(d, F_SETFL, flag), ec); } -#else // defined(__SYMBIAN32__) +#else // defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) ioctl_arg_type arg = (value ? 1 : 0); int result = error_wrapper(::ioctl(d, FIONBIO, &arg), ec); -#endif // defined(__SYMBIAN32__) +#endif // defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) if (result >= 0) { @@ -137,7 +137,7 @@ bool set_internal_non_blocking(int d, state_type& state, } errno = 0; -#if defined(__SYMBIAN32__) +#if defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) int result = error_wrapper(::fcntl(d, F_GETFL, 0), ec); if (result >= 0) { @@ -145,10 +145,10 @@ bool set_internal_non_blocking(int d, state_type& state, int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK)); result = error_wrapper(::fcntl(d, F_SETFL, flag), ec); } -#else // defined(__SYMBIAN32__) +#else // defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) ioctl_arg_type arg = (value ? 1 : 0); int result = error_wrapper(::ioctl(d, FIONBIO, &arg), ec); -#endif // defined(__SYMBIAN32__) +#endif // defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) if (result >= 0) { diff --git a/asio/include/asio/detail/impl/socket_ops.ipp b/asio/include/asio/detail/impl/socket_ops.ipp index 4b492daead..bacd6008ae 100644 --- a/asio/include/asio/detail/impl/socket_ops.ipp +++ b/asio/include/asio/detail/impl/socket_ops.ipp @@ -330,14 +330,14 @@ int close(socket_type s, state_type& state, ioctl_arg_type arg = 0; ::ioctlsocket(s, FIONBIO, &arg); #else // defined(ASIO_WINDOWS) || defined(__CYGWIN__) -# if defined(__SYMBIAN32__) +# if defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) int flags = ::fcntl(s, F_GETFL, 0); if (flags >= 0) ::fcntl(s, F_SETFL, flags & ~O_NONBLOCK); -# else // defined(__SYMBIAN32__) +# else // defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) ioctl_arg_type arg = 0; ::ioctl(s, FIONBIO, &arg); -# endif // defined(__SYMBIAN32__) +# endif // defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__) state &= ~non_blocking; @@ -368,7 +368,7 @@ bool set_user_non_blocking(socket_type s, #if defined(ASIO_WINDOWS) || defined(__CYGWIN__) ioctl_arg_type arg = (value ? 1 : 0); int result = error_wrapper(::ioctlsocket(s, FIONBIO, &arg), ec); -#elif defined(__SYMBIAN32__) +#elif defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) int result = error_wrapper(::fcntl(s, F_GETFL, 0), ec); if (result >= 0) { @@ -421,7 +421,7 @@ bool set_internal_non_blocking(socket_type s, #if defined(ASIO_WINDOWS) || defined(__CYGWIN__) ioctl_arg_type arg = (value ? 1 : 0); int result = error_wrapper(::ioctlsocket(s, FIONBIO, &arg), ec); -#elif defined(__SYMBIAN32__) +#elif defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) int result = error_wrapper(::fcntl(s, F_GETFL, 0), ec); if (result >= 0) { @@ -1762,6 +1762,9 @@ int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, timeval* timeout, asio::error_code& ec) { clear_last_error(); +#if defined(__EMSCRIPTEN__) + exceptfds = 0; +#endif // defined(__EMSCRIPTEN__) #if defined(ASIO_WINDOWS) || defined(__CYGWIN__) if (!readfds && !writefds && !exceptfds && timeout) {