[or-cvs] Add a macro to catch unhandled openssl errors.
Nick Mathewson
nickm at seul.org
Mon Apr 26 23:00:09 UTC 2004
Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/tmp/cvs-serv30542/src/common
Modified Files:
tortls.c tortls.h
Log Message:
Add a macro to catch unhandled openssl errors.
Index: tortls.c
===================================================================
RCS file: /home/or/cvsroot/src/common/tortls.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- tortls.c 26 Apr 2004 22:22:11 -0000 1.49
+++ tortls.c 26 Apr 2004 23:00:07 -0000 1.50
@@ -618,6 +618,18 @@
return BIO_number_written(SSL_get_wbio(tls->ssl));
}
+void _assert_no_tls_errors(const char *fname, int line)
+{
+ if (ERR_peek_error() == 0)
+ return;
+ log_fn(LOG_ERR, "Unhandled OpenSSL errors found at %s:%d: ",
+ fname, line);
+ tls_log_errors(LOG_ERR, NULL);
+
+ tor_assert(0);
+}
+
+
/*
Local Variables:
mode:c
Index: tortls.h
===================================================================
RCS file: /home/or/cvsroot/src/common/tortls.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- tortls.h 24 Apr 2004 22:17:50 -0000 1.12
+++ tortls.h 26 Apr 2004 23:00:07 -0000 1.13
@@ -33,6 +33,10 @@
unsigned long tor_tls_get_n_bytes_read(tor_tls *tls);
unsigned long tor_tls_get_n_bytes_written(tor_tls *tls);
+#define assert_no_tls_errors() _assert_no_tls_errors(__FILE__,__LINE__);
+
+void _assert_no_tls_errors(const char *fname, int line);
+
#endif
/*
More information about the tor-commits
mailing list