summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/compat.c23
-rw-r--r--src/common/compat.h4
2 files changed, 3 insertions, 24 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index 354af77ea4..4a95a1ac12 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -415,17 +415,8 @@ tor_socketpair(int family, int type, int protocol, int fd[2])
}
listener = socket(AF_INET, type, 0);
- if (listener == -1)
+ if (listener < 0)
return -tor_socket_errno(-1);
- if (!SOCKET_IS_POLLABLE(listener)) {
- log_warn(LD_NET, "Too many connections; can't open socketpair");
- tor_close_socket(listener);
-#ifdef MS_WINDOWS
- return -ENFILE;
-#else
- return -ENCONN;
-#endif
- }
memset(&listen_addr, 0, sizeof(listen_addr));
listen_addr.sin_family = AF_INET;
listen_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
@@ -437,12 +428,8 @@ tor_socketpair(int family, int type, int protocol, int fd[2])
goto tidy_up_and_fail;
connector = socket(AF_INET, type, 0);
- if (connector == -1)
+ if (connector < 0)
goto tidy_up_and_fail;
- if (!SOCKET_IS_POLLABLE(connector)) {
- log_warn(LD_NET, "Too many connections; can't open socketpair");
- goto tidy_up_and_fail;
- }
/* We want to find out the port number to connect to. */
size = sizeof(connect_addr);
if (getsockname(listener, (struct sockaddr *) &connect_addr, &size) == -1)
@@ -455,12 +442,8 @@ tor_socketpair(int family, int type, int protocol, int fd[2])
size = sizeof(listen_addr);
acceptor = accept(listener, (struct sockaddr *) &listen_addr, &size);
- if (acceptor == -1)
+ if (acceptor < 0)
goto tidy_up_and_fail;
- if (!SOCKET_IS_POLLABLE(acceptor)) {
- log_warn(LD_NET, "Too many connections; can't open socketpair");
- goto tidy_up_and_fail;
- }
if (size != sizeof(listen_addr))
goto abort_tidy_up_and_fail;
tor_close_socket(listener);
diff --git a/src/common/compat.h b/src/common/compat.h
index 6116264d79..b70963b4be 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -175,10 +175,6 @@ int touch_file(const char *fname);
typedef int socklen_t;
#endif
-/* Now that we use libevent, all real sockets are safe for polling ... or
- * if they aren't, libevent will help us. */
-#define SOCKET_IS_POLLABLE(fd) ((fd)>=0)
-
struct in_addr;
int tor_inet_aton(const char *cp, struct in_addr *addr);
int tor_lookup_hostname(const char *name, uint32_t *addr);