From 396333e0a3fec1259a5813561cc3221957725577 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Thu, 26 Sep 2013 13:32:19 +0200 Subject: [PATCH] Updated ssl_test to handle EOF return value --- programs/test/ssl_test.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/programs/test/ssl_test.c b/programs/test/ssl_test.c index 97e308f7f..20907d8db 100644 --- a/programs/test/ssl_test.c +++ b/programs/test/ssl_test.c @@ -329,7 +329,7 @@ static int ssl_test( struct options *opt ) if( opt->command & COMMAND_READ ) { - if( bytes_to_read == 0 ) + while( bytes_to_read == 0 ) { bytes_to_read = rand() % opt->buffer_size; offset_to_read = 0; @@ -338,7 +338,7 @@ static int ssl_test( struct options *opt ) ret = ssl_read( &ssl, read_buf + offset_to_read, bytes_to_read ); - if( ret >= 0 ) + if( ret > 0 ) { for( i = 0; i < ret; i++ ) { @@ -356,7 +356,9 @@ static int ssl_test( struct options *opt ) offset_to_read += ret; } - if( ret == POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY || + if( ret == 0 || + ret == POLARSSL_ERR_SSL_CONN_EOF || + ret == POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY || ret == POLARSSL_ERR_NET_CONN_RESET ) { ret = 0;