summaryrefslogtreecommitdiff
path: root/src/common/tortls.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-11-07 16:37:08 +0000
committerNick Mathewson <nickm@torproject.org>2007-11-07 16:37:08 +0000
commit0e993e6008aa0c0c5fc932bc0b84a46a9c681315 (patch)
tree735bbed65c5b59e3c40939e8c821be8925ca8192 /src/common/tortls.c
parent7b826f8fe47f20d784f42bb3f04c4597635c801f (diff)
downloadtor-0e993e6008aa0c0c5fc932bc0b84a46a9c681315.tar.gz
tor-0e993e6008aa0c0c5fc932bc0b84a46a9c681315.zip
r16523@catbus: nickm | 2007-11-07 11:35:49 -0500
Improve "tls error. breaking" message a little. svn:r12411
Diffstat (limited to 'src/common/tortls.c')
-rw-r--r--src/common/tortls.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c
index 4b46f9d9d2..5b902c9e9a 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -145,6 +145,26 @@ tor_errno_to_tls_error(int e)
#endif
}
+/** DOCDOC */
+const char *
+tor_tls_err_to_string(int err)
+{
+ if (err >= 0)
+ return "[Not an error.]";
+ switch (err) {
+ case TOR_TLS_ERROR_MISC: return "misc error";
+ case TOR_TLS_ERROR_IO: return "unexpected close";
+ case TOR_TLS_ERROR_CONNREFUSED: return "connection refused";
+ case TOR_TLS_ERROR_CONNRESET: return "connection reset";
+ case TOR_TLS_ERROR_NO_ROUTE: return "host unreachable";
+ case TOR_TLS_ERROR_TIMEOUT: return "connection timed out";
+ case TOR_TLS_CLOSE: return "closed";
+ case TOR_TLS_WANTREAD: return "want to read";
+ case TOR_TLS_WANTWRITE: return "want to write";
+ default: return "(unknown error code)";
+ }
+}
+
#define CATCH_SYSCALL 1
#define CATCH_ZERO 2