aboutsummaryrefslogtreecommitdiff
path: root/src/compat.h
diff options
context:
space:
mode:
authorPatrick Strateman <patrick.strateman@gmail.com>2018-09-26 21:54:52 -0400
committerPatrick Strateman <patrick.strateman@gmail.com>2018-12-03 14:25:51 -0500
commit11cc491a288a73e911be24a285e12abd57df7d04 (patch)
treeb10300e0223359f4c3b0b10b5aa8ed91ffd1d1e6 /src/compat.h
parent28211a4bc9c65859b641b81a0541726a0e01988f (diff)
downloadbitcoin-11cc491a288a73e911be24a285e12abd57df7d04.tar.xz
Implement poll() on systems which support it properly.
This eliminates the restriction on maximum socket descriptor number.
Diffstat (limited to 'src/compat.h')
-rw-r--r--src/compat.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/compat.h b/src/compat.h
index 049579c365..7b164d5630 100644
--- a/src/compat.h
+++ b/src/compat.h
@@ -92,8 +92,15 @@ typedef void* sockopt_arg_type;
typedef char* sockopt_arg_type;
#endif
+// Note these both should work with the current usage of poll, but best to be safe
+// WIN32 poll is broken https://daniel.haxx.se/blog/2012/10/10/wsapoll-is-broken/
+// __APPLE__ poll is broke https://github.com/bitcoin/bitcoin/pull/14336#issuecomment-437384408
+#if defined(__linux__)
+#define USE_POLL
+#endif
+
bool static inline IsSelectableSocket(const SOCKET& s) {
-#ifdef WIN32
+#if defined(USE_POLL) || defined(WIN32)
return true;
#else
return (s < FD_SETSIZE);