diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-01-17 09:20:24 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-01-17 09:20:24 -0500 |
commit | d094a76cc8239f9d0e4123d87a0c8531b22cba79 (patch) | |
tree | d14dc88d41f1cb2be9000e65d81f2804d53ef584 | |
parent | aa01d0a18337787209241d08a630a2d8c10f29f0 (diff) | |
parent | 9bd811b337f1316d26e5553f4d8720c9353d1b5d (diff) | |
download | tor-d094a76cc8239f9d0e4123d87a0c8531b22cba79.tar.gz tor-d094a76cc8239f9d0e4123d87a0c8531b22cba79.zip |
Merge remote-tracking branch 'public/bug6302'
-rw-r--r-- | src/common/tortls.c | 26 | ||||
-rw-r--r-- | src/or/connection.c | 6 |
2 files changed, 6 insertions, 26 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c index 251915d985..6151d3fde4 100644 --- a/src/common/tortls.c +++ b/src/common/tortls.c @@ -362,35 +362,19 @@ tls_log_errors(tor_tls_t *tls, int severity, int domain, const char *doing) static int tor_errno_to_tls_error(int e) { -#if defined(_WIN32) switch (e) { - case WSAECONNRESET: // most common + case SOCK_ERRNO(ECONNRESET): // most common return TOR_TLS_ERROR_CONNRESET; - case WSAETIMEDOUT: + case SOCK_ERRNO(ETIMEDOUT): return TOR_TLS_ERROR_TIMEOUT; - case WSAENETUNREACH: - case WSAEHOSTUNREACH: + case SOCK_ERRNO(EHOSTUNREACH): + case SOCK_ERRNO(ENETUNREACH): return TOR_TLS_ERROR_NO_ROUTE; - case WSAECONNREFUSED: + case SOCK_ERRNO(ECONNREFUSED): return TOR_TLS_ERROR_CONNREFUSED; // least common default: return TOR_TLS_ERROR_MISC; } -#else - switch (e) { - case ECONNRESET: // most common - return TOR_TLS_ERROR_CONNRESET; - case ETIMEDOUT: - return TOR_TLS_ERROR_TIMEOUT; - case EHOSTUNREACH: - case ENETUNREACH: - return TOR_TLS_ERROR_NO_ROUTE; - case ECONNREFUSED: - return TOR_TLS_ERROR_CONNREFUSED; // least common - default: - return TOR_TLS_ERROR_MISC; - } -#endif } /** Given a TOR_TLS_* error code, return a string equivalent. */ diff --git a/src/or/connection.c b/src/or/connection.c index 74857b52ca..b3719151f0 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1442,11 +1442,7 @@ connection_connect(connection_t *conn, const char *address, * Warn if we do, and refuse to make the connection. */ static ratelim_t disablenet_violated = RATELIM_INIT(30*60); char *m; -#ifdef _WIN32 - *socket_error = WSAENETUNREACH; -#else - *socket_error = ENETUNREACH; -#endif + *socket_error = SOCK_ERRNO(ENETUNREACH); if ((m = rate_limit_log(&disablenet_violated, approx_time()))) { log_warn(LD_BUG, "Tried to open a socket with DisableNetwork set.%s", m); tor_free(m); |