aboutsummaryrefslogtreecommitdiff
path: root/src/netbase.cpp
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2017-10-02 14:18:32 -0400
committerCory Fields <cory-nospam-@coryfields.com>2017-12-12 15:25:25 -0500
commit9e3b2f576bb368a0857e808dcbd24b2dcb8bef2d (patch)
tree94370b8776d0bb11a6cb376fb5f94317a59b7b92 /src/netbase.cpp
parent1729c29dedc64d900a1a1c686a56e16fa5417fa1 (diff)
net: Move IsSelectableSocket check into socket creation
We use select in ConnectSocketDirectly, so this check needs to happen before that. IsSelectableSocket will not be relevant after upcoming changes to remove select.
Diffstat (limited to 'src/netbase.cpp')
-rw-r--r--src/netbase.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp
index 9b63d60342..1635957b7f 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -465,6 +465,12 @@ SOCKET CreateSocket(const CService &addrConnect)
if (hSocket == INVALID_SOCKET)
return INVALID_SOCKET;
+ if (!IsSelectableSocket(hSocket)) {
+ CloseSocket(hSocket);
+ LogPrintf("Cannot create connection: non-selectable socket created (fd >= FD_SETSIZE ?)\n");
+ return INVALID_SOCKET;
+ }
+
#ifdef SO_NOSIGPIPE
int set = 1;
// Different way of disabling SIGPIPE on BSD