From 34377b1e1c03faa59b6d6d165d1b6c7350f1402a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 22 Jan 2015 10:46:46 +0000 Subject: [PATCH] Fix send_close_notify usage. --- programs/ssl/ssl_client2.c | 6 ++++-- programs/ssl/ssl_server2.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index 48b95af5b..657202944 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -1299,8 +1299,10 @@ send_request: close_notify: printf( " . Closing the connection..." ); - /* Don't check for errors, the connection might already be closed */ - ssl_close_notify( &ssl ); + /* No error checking, the connection might be closed already */ + do ret = ssl_close_notify( &ssl ); + while( ret == POLARSSL_ERR_NET_WANT_WRITE ); + ret = 0; printf( " done\n" ); diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index 70fffc533..5b4a6bdac 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -1803,8 +1803,10 @@ data_exchange: close_notify: printf( " . Closing the connection..." ); - /* Don't check for errors, the connection might already be closed */ - ssl_close_notify( &ssl ); + /* No error checking, the connection might be closed already */ + do ret = ssl_close_notify( &ssl ); + while( ret == POLARSSL_ERR_NET_WANT_WRITE ); + ret = 0; printf( " done\n" ); goto reset;