Skip to content

Commit

Permalink
Fixed build when MBEDTLS_DEBUG_C is turned off
Browse files Browse the repository at this point in the history
MBEDTLS_DEBUG_C is a flag that can be disabled in mbedtls/config.h,
to disable mbedTLS's debug logging. I tried doing so, which revealed
two compile errors in mbdetls_context.cpp. This fixes them.
  • Loading branch information
snej committed Apr 26, 2021
1 parent ffde73a commit db1955b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mbedtls_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,14 @@ namespace sockpp {

public:

#ifdef MBEDTLS_DEBUG_C
#define log(LEVEL, FMT,...) do { \
auto ssl = &ssl_; \
MBEDTLS_SSL_DEBUG_MSG(LEVEL, ("SockPP: " FMT, ## __VA_ARGS__)); \
}while(0)
#else
#define log(LEVEL, FMT,...) do { } while(0)
#endif


int log_mbed_ret(int ret, const char *fn) {
Expand Down Expand Up @@ -628,7 +632,9 @@ namespace sockpp {
}, this);
}
logger_ = logger;
#ifdef MBEDTLS_DEBUG_C
mbedtls_debug_set_threshold(threshold);
#endif
}


Expand Down

0 comments on commit db1955b

Please sign in to comment.