Add debug_set_threshold() and thresholding of messages
diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c
index 7c043eb..012403a 100644
--- a/programs/ssl/ssl_client2.c
+++ b/programs/ssl/ssl_client2.c
@@ -36,6 +36,7 @@
#include "polarssl/certs.h"
#include "polarssl/x509.h"
#include "polarssl/error.h"
+#include "polarssl/debug.h"
#if defined(POLARSSL_TIMING_C)
#include "polarssl/timing.h"
@@ -112,11 +113,10 @@
static void my_debug( void *ctx, int level, const char *str )
{
- if( level < opt.debug_level )
- {
- fprintf( (FILE *) ctx, "%s", str );
- fflush( (FILE *) ctx );
- }
+ ((void) level);
+
+ fprintf( (FILE *) ctx, "%s", str );
+ fflush( (FILE *) ctx );
}
/*
@@ -589,6 +589,10 @@
goto usage;
}
+#if defined(POLARSSL_DEBUG_C)
+ debug_set_threshold( opt.debug_level );
+#endif
+
if( opt.force_ciphersuite[0] > 0 )
{
const ssl_ciphersuite_t *ciphersuite_info;