summaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-06-05 09:08:10 +0000
committerRoger Dingledine <arma@torproject.org>2006-06-05 09:08:10 +0000
commit45065f1466bc5f5eaea0e837938b97808511f143 (patch)
tree6c0ede89d1f088a946d545c05fa727573fac38d7 /src/or/connection.c
parent4e773352c2ceb75f144c5da11046428e3d4d88c7 (diff)
downloadtor-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/or/connection.c')
-rw-r--r--src/or/connection.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index a28d625673..6a89891dce 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -532,10 +532,6 @@ connection_create_listener(const char *listenaddress, uint16_t listenport,
if (s < 0) {
log_warn(LD_NET,"Socket creation failed.");
goto err;
- } else if (!SOCKET_IS_POLLABLE(s)) {
- log_warn(LD_NET,"Too many connections; can't create pollable listener.");
- tor_close_socket(s);
- goto err;
}
#ifndef MS_WINDOWS
@@ -635,16 +631,9 @@ connection_handle_listener_read(connection_t *conn, int new_type)
memset(addrbuf, 0, sizeof(addrbuf));
news = accept(conn->s,(struct sockaddr *)&addrbuf,&remotelen);
- if (!SOCKET_IS_POLLABLE(news)) {
- /* accept() error, or too many conns to poll */
- int e;
- if (news>=0) {
- /* Too many conns to poll. */
- log_warn(LD_NET,"Too many connections; couldn't accept connection.");
- tor_close_socket(news);
- return 0;
- }
- e = tor_socket_errno(conn->s);
+ if (news < 0) {
+ /* accept() error */
+ int e = tor_socket_errno(conn->s);
if (ERRNO_IS_ACCEPT_EAGAIN(e)) {
return 0; /* he hung up before we could accept(). that's fine. */
} else if (ERRNO_IS_ACCEPT_RESOURCE_LIMIT(e)) {
@@ -771,12 +760,6 @@ connection_connect(connection_t *conn, char *address,
log_warn(LD_NET,"Error creating network socket: %s",
tor_socket_strerror(tor_socket_errno(-1)));
return -1;
- } else if (!SOCKET_IS_POLLABLE(s)) {
- log_warn(LD_NET,
- "Too many connections; can't create pollable connection to %s",
- escaped_safe_str(address));
- tor_close_socket(s);
- return -1;
}
if (options->OutboundBindAddress) {