mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-29 12:32:48 +00:00
Avoid debug flooding with non-blocking reads
This commit is contained in:
parent
e3a062ba1f
commit
4cba1a737d
@ -108,6 +108,14 @@ void mbedtls_debug_print_ret( const mbedtls_ssl_context *ssl, int level,
|
|||||||
if( ssl->conf->f_dbg == NULL || level > debug_threshold )
|
if( ssl->conf->f_dbg == NULL || level > debug_threshold )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* With non-blocking I/O and examples that just retry immediately,
|
||||||
|
* the logs would be quickly flooded with WANT_READ, so ignore that.
|
||||||
|
* Don't ignore WANT_WRITE however, since is is usually rare.
|
||||||
|
*/
|
||||||
|
if( ret == MBEDTLS_ERR_SSL_WANT_READ )
|
||||||
|
return;
|
||||||
|
|
||||||
if( debug_log_mode == MBEDTLS_DEBUG_LOG_FULL )
|
if( debug_log_mode == MBEDTLS_DEBUG_LOG_FULL )
|
||||||
idx = mbedtls_snprintf( str, maxlen, "%s(%04d): ", file, line );
|
idx = mbedtls_snprintf( str, maxlen, "%s(%04d): ", file, line );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user