Merge pull request #4230 from rrlapointe/dtls_demo_use_read_timeout_2.16

2.16: Actually use the READ_TIMEOUT_MS in the example DTLS client and server
This commit is contained in:
Gilles Peskine 2021-03-17 14:39:47 +01:00 committed by GitHub
commit 09d33092cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,2 @@
Changes
* Fix the setting of the read timeout in the DTLS sample programs.

View File

@ -218,6 +218,7 @@ int main( int argc, char *argv[] )
mbedtls_ssl_conf_ca_chain( &conf, &cacert, NULL ); mbedtls_ssl_conf_ca_chain( &conf, &cacert, NULL );
mbedtls_ssl_conf_rng( &conf, mbedtls_ctr_drbg_random, &ctr_drbg ); mbedtls_ssl_conf_rng( &conf, mbedtls_ctr_drbg_random, &ctr_drbg );
mbedtls_ssl_conf_dbg( &conf, my_debug, stdout ); mbedtls_ssl_conf_dbg( &conf, my_debug, stdout );
mbedtls_ssl_conf_read_timeout( &conf, READ_TIMEOUT_MS );
if( ( ret = mbedtls_ssl_setup( &ssl, &conf ) ) != 0 ) if( ( ret = mbedtls_ssl_setup( &ssl, &conf ) ) != 0 )
{ {

View File

@ -114,7 +114,7 @@ int main( void )
#include "mbedtls/ssl_cache.h" #include "mbedtls/ssl_cache.h"
#endif #endif
#define READ_TIMEOUT_MS 10000 /* 5 seconds */ #define READ_TIMEOUT_MS 10000 /* 10 seconds */
#define DEBUG_LEVEL 0 #define DEBUG_LEVEL 0
@ -250,6 +250,7 @@ int main( void )
mbedtls_ssl_conf_rng( &conf, mbedtls_ctr_drbg_random, &ctr_drbg ); mbedtls_ssl_conf_rng( &conf, mbedtls_ctr_drbg_random, &ctr_drbg );
mbedtls_ssl_conf_dbg( &conf, my_debug, stdout ); mbedtls_ssl_conf_dbg( &conf, my_debug, stdout );
mbedtls_ssl_conf_read_timeout( &conf, READ_TIMEOUT_MS );
#if defined(MBEDTLS_SSL_CACHE_C) #if defined(MBEDTLS_SSL_CACHE_C)
mbedtls_ssl_conf_session_cache( &conf, &cache, mbedtls_ssl_conf_session_cache( &conf, &cache,