mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
Added TLS lib debug messages printing
This commit is contained in:
@@ -466,6 +466,17 @@
|
||||
__pragma(runtime_checks("c", restore))
|
||||
#endif /* _MSC_FULL_VER */
|
||||
|
||||
#ifdef _DEBUG
|
||||
# ifndef MHD_NO_TLS_DEBUG_MESSAGES
|
||||
# ifndef mhd_USE_TLS_DEBUG_MESSAGES
|
||||
/**
|
||||
* Enable debugging output on TLS library (if possible)
|
||||
*/
|
||||
# define mhd_USE_TLS_DEBUG_MESSAGES 1
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Un-define some HAVE_DECL_* macro if they equal zero.
|
||||
This should allow safely use #ifdef in the code.
|
||||
Define HAS_DECL_* macros only if matching HAVE_DECL_* macro
|
||||
|
||||
@@ -58,10 +58,26 @@
|
||||
# include "tls_dh_params.h"
|
||||
#endif
|
||||
|
||||
#ifdef mhd_USE_TLS_DEBUG_MESSAGES
|
||||
# include <stdio.h> /* For TLS debug printing */
|
||||
#endif
|
||||
|
||||
struct mhd_TlsGnuDaemonData; /* Forward declaration */
|
||||
|
||||
struct mhd_TlsGnuConnData; /* Forward declaration */
|
||||
|
||||
#ifdef mhd_USE_TLS_DEBUG_MESSAGES
|
||||
static void
|
||||
mhd_tls_gnu_debug_print (int level, const char *msg)
|
||||
{
|
||||
(void) fprintf (stderr, "## GnuTLS %02i: %s",
|
||||
level,
|
||||
msg);
|
||||
(void) fflush (stderr);
|
||||
}
|
||||
|
||||
|
||||
#endif /* mhd_USE_TLS_DEBUG_MESSAGES */
|
||||
|
||||
/* ** Global initialisation / de-initialisation ** */
|
||||
|
||||
@@ -77,12 +93,21 @@ mhd_tls_gnu_global_init (void)
|
||||
#endif
|
||||
gnutls_lib_inited =
|
||||
gnutls_lib_inited && (GNUTLS_E_SUCCESS == gnutls_global_init ());
|
||||
|
||||
#ifdef mhd_USE_TLS_DEBUG_MESSAGES
|
||||
gnutls_global_set_log_function (&mhd_tls_gnu_debug_print);
|
||||
gnutls_global_set_log_level (2);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
MHD_INTERNAL void
|
||||
mhd_tls_gnu_global_deinit (void)
|
||||
{
|
||||
#ifdef mhd_USE_TLS_DEBUG_MESSAGES
|
||||
gnutls_global_set_log_level (0);
|
||||
#endif
|
||||
|
||||
if (gnutls_lib_inited)
|
||||
gnutls_global_deinit ();
|
||||
gnutls_lib_inited = false;
|
||||
|
||||
Reference in New Issue
Block a user