diff options
author | Roger Dingledine <arma@torproject.org> | 2006-06-05 09:08:10 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2006-06-05 09:08:10 +0000 |
commit | 45065f1466bc5f5eaea0e837938b97808511f143 (patch) | |
tree | 6c0ede89d1f088a946d545c05fa727573fac38d7 /src/common/compat.c | |
parent | 4e773352c2ceb75f144c5da11046428e3d4d88c7 (diff) | |
download | tor-45065f1466bc5f5eaea0e837938b97808511f143.tar.gz tor-45065f1466bc5f5eaea0e837938b97808511f143.zip |
simplify code now that libevent considers all sockets pollable.
what we really mean now is ">= 0", which is clearer to test for.
svn:r6543
Diffstat (limited to 'src/common/compat.c')
-rw-r--r-- | src/common/compat.c | 23 |
1 files changed, 3 insertions, 20 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); |