diff --git a/src/common/address.c b/src/common/address.c index 561fa07b74..a47b1228f9 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -560,22 +560,6 @@ tor_addr_parse_mask_ports(const char *s, tor_addr_t *addr_out, v4map = tor_addr_is_v4(addr_out); -/* -#ifdef ALWAYS_V6_MAP - if (v_family == AF_INET) { - v_family = AF_INET6; - IN_ADDR6(addr_out).s6_addr32[3] = IN6_ADDRESS(addr_out).s_addr; - memset(&IN6_ADDRESS(addr_out), 0, 10); - IN_ADDR6(addr_out).s6_addr16[5] = 0xffff; - } -#else - if (v_family == AF_INET6 && v4map) { - v_family = AF_INET; - IN4_ADDRESS((addr_out).s_addr = IN6_ADDRESS(addr_out).s6_addr32[3]; - } -#endif -*/ - /* Parse mask */ if (maskbits_out) { int bits = 0; diff --git a/src/common/compat.c b/src/common/compat.c index d5de6f58e1..188c2a84fe 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -87,10 +87,6 @@ const char compat_c_id[] = #include #endif -#ifdef USE_BSOCKETS -#include -#endif - #include "log.h" #include "util.h" #include "container.h" @@ -630,9 +626,7 @@ tor_close_socket(int s) * tor_close_socket to close sockets, and always using close() on * files. */ -#ifdef USE_BSOCKETS - r = bclose(s); -#elif defined(MS_WINDOWS) +#if defined(MS_WINDOWS) r = closesocket(s); #else r = close(s); @@ -718,7 +712,7 @@ get_n_open_sockets(void) void set_socket_nonblocking(int socket) { -#if defined(MS_WINDOWS) && !defined(USE_BSOCKETS) +#if defined(MS_WINDOWS) unsigned long nonblocking = 1; ioctlsocket(socket, FIONBIO, (unsigned long*) &nonblocking); #else @@ -761,8 +755,6 @@ tor_socketpair(int family, int type, int protocol, int fd[2]) } } return r < 0 ? -errno : r; -#elif defined(USE_BSOCKETS) - return bsocketpair(family, type, protocol, fd); #else /* This socketpair does not work when localhost is down. So * it's really not the same thing at all. But it's close enough @@ -2082,7 +2074,7 @@ tor_threads_init(void) * should call tor_socket_errno at most once on the failing * socket to get the error. */ -#if defined(MS_WINDOWS) && !defined(USE_BSOCKETS) +#if defined(MS_WINDOWS) int tor_socket_errno(int sock) { @@ -2098,7 +2090,7 @@ tor_socket_errno(int sock) } #endif -#if defined(MS_WINDOWS) && !defined(USE_BSOCKETS) +#if defined(MS_WINDOWS) #define E(code, s) { code, (s " [" #code " ]") } struct { int code; const char *msg; } windows_socket_errors[] = { E(WSAEINTR, "Interrupted function call"), diff --git a/src/common/compat.h b/src/common/compat.h index 47156f241b..6dd2f99f2a 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -324,13 +324,8 @@ int tor_open_socket(int domain, int type, int protocol); int tor_accept_socket(int sockfd, struct sockaddr *addr, socklen_t *len); int get_n_open_sockets(void); -#ifdef USE_BSOCKETS -#define tor_socket_send(s, buf, len, flags) bsend(s, buf, len, flags) -#define tor_socket_recv(s, buf, len, flags) brecv(s, buf, len, flags) -#else #define tor_socket_send(s, buf, len, flags) send(s, buf, len, flags) #define tor_socket_recv(s, buf, len, flags) recv(s, buf, len, flags) -#endif /* Define struct in6_addr on platforms that do not have it. Generally, * these platforms are ones without IPv6 support, but we want to have @@ -403,7 +398,7 @@ int network_init(void); * errnos against expected values, and use tor_socket_errno to find * the actual errno after a socket operation fails. */ -#if defined(MS_WINDOWS) && !defined(USE_BSOCKETS) +#if defined(MS_WINDOWS) /** Return true if e is EAGAIN or the local equivalent. */ #define ERRNO_IS_EAGAIN(e) ((e) == EAGAIN || (e) == WSAEWOULDBLOCK) /** Return true if e is EINPROGRESS or the local equivalent. */ diff --git a/src/common/log.c b/src/common/log.c index f43181848f..78d439130c 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -95,12 +95,9 @@ should_log_function_name(log_domain_mask_t domain, int severity) } } -#define USE_LOG_MUTEX - -#ifdef USE_LOG_MUTEX /** A mutex to guard changes to logfiles and logging. */ static tor_mutex_t *log_mutex = NULL; -#endif + /** Linked list of logfile_t. */ static logfile_t *logfiles = NULL; #ifdef HAVE_SYSLOG_H @@ -109,15 +106,10 @@ static logfile_t *logfiles = NULL; static int syslog_count = 0; #endif -#ifdef USE_LOG_MUTEX #define LOCK_LOGS() STMT_BEGIN \ tor_mutex_acquire(log_mutex); \ STMT_END #define UNLOCK_LOGS() STMT_BEGIN tor_mutex_release(log_mutex); STMT_END -#else -#define LOCK_LOGS() STMT_NIL -#define UNLOCK_LOGS() STMT_NIL -#endif /** What's the lowest log level anybody cares about? Checking this lets us * bail out early from log_debug if we aren't debugging. */ diff --git a/src/common/mempool.c b/src/common/mempool.c index d489cf6550..6f3edbd6d8 100644 --- a/src/common/mempool.c +++ b/src/common/mempool.c @@ -12,8 +12,6 @@ #define MEMPOOL_PRIVATE #include "mempool.h" -#define LAZY_CHUNK_SORT - /* OVERVIEW: * * This is an implementation of memory pools for Tor cells. It may be @@ -407,7 +405,6 @@ mp_pool_new(size_t item_size, size_t chunk_capacity) return pool; } -#ifdef LAZY_CHUNK_SORT /** Helper function for qsort: used to sort pointers to mp_chunk_t into * descending order of fullness. */ static int @@ -449,17 +446,8 @@ mp_pool_sort_used_chunks(mp_pool_t *pool) } chunks[n-1]->next = NULL; FREE(chunks); -#if 0 - inverted = 0; - for (chunk = pool->used_chunks; chunk; chunk = chunk->next) { - if (chunk->next) { - ASSERT(chunk->next->n_allocated <= chunk->n_allocated); - } - } -#endif mp_pool_assert_ok(pool); } -#endif /** If there are more than n empty chunks in pool, free the * excess ones that have been empty for the longest. If @@ -471,9 +459,7 @@ mp_pool_clean(mp_pool_t *pool, int n_to_keep, int keep_recently_used) { mp_chunk_t *chunk, **first_to_free; -#ifdef LAZY_CHUNK_SORT mp_pool_sort_used_chunks(pool); -#endif ASSERT(n_to_keep >= 0); if (keep_recently_used) { diff --git a/src/common/tortls.c b/src/common/tortls.c index 0d9a5defe0..20c1d06761 100644 --- a/src/common/tortls.c +++ b/src/common/tortls.c @@ -199,7 +199,7 @@ tls_log_errors(tor_tls_t *tls, int severity, const char *doing) static int tor_errno_to_tls_error(int e) { -#if defined(MS_WINDOWS) && !defined(USE_BSOCKETS) +#if defined(MS_WINDOWS) switch (e) { case WSAECONNRESET: // most common return TOR_TLS_ERROR_CONNRESET; @@ -839,11 +839,7 @@ tor_tls_new(int sock, int isServer) if (!isServer) rectify_client_ciphers(&result->ssl->cipher_list); result->socket = sock; -#ifdef USE_BSOCKETS - bio = BIO_new_bsocket(sock, BIO_NOCLOSE); -#else bio = BIO_new_socket(sock, BIO_NOCLOSE); -#endif if (! bio) { tls_log_errors(NULL, LOG_WARN, "opening BIO"); SSL_free(result->ssl); diff --git a/src/or/buffers.c b/src/or/buffers.c index f070755310..ed819789e4 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -23,7 +23,6 @@ const char buffers_c_id[] = #endif //#define PARANOIA -//#define NOINLINE #ifdef PARANOIA /** Helper: If PARANOIA is defined, assert that the buffer in local variable @@ -33,11 +32,6 @@ const char buffers_c_id[] = #define check() STMT_NIL #endif -#ifdef NOINLINE -#undef INLINE -#define INLINE -#endif - /* Implementation notes: * * After flirting with memmove, and dallying with ring-buffers, we're finally diff --git a/src/or/onion.c b/src/or/onion.c index a51dc3e7ac..b73e174298 100644 --- a/src/or/onion.c +++ b/src/or/onion.c @@ -187,21 +187,6 @@ onion_skin_create(crypto_pk_env_t *dest_router_key, if (crypto_dh_get_public(dh, challenge, dhbytes)) goto err; -#ifdef DEBUG_ONION_SKINS -#define PA(a,n) \ - { int _i; for (_i = 0; _i