From 61da752077fa8ebfb1aff199bb18b697364ee27c Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Fri, 11 Nov 2011 10:28:58 +0000 Subject: [PATCH] - Changed read from server loop to read more than a single read. --- programs/ssl/ssl_client1.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/programs/ssl/ssl_client1.c b/programs/ssl/ssl_client1.c index a4cf5fcf5..2ffe30c40 100644 --- a/programs/ssl/ssl_client1.c +++ b/programs/ssl/ssl_client1.c @@ -156,16 +156,22 @@ int main( void ) if( ret == POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY ) break; - if( ret <= 0 ) + if( ret < 0 ) { printf( "failed\n ! ssl_read returned %d\n\n", ret ); break; } + if( ret == 0 ) + { + printf( "\n\nEOF\n\n" ); + break; + } + len = ret; printf( " %d bytes read\n\n%s", len, (char *) buf ); } - while( 0 ); + while( 1 ); ssl_close_notify( &ssl );