diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index 48b95af5b5..6572029443 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 70fffc5333..5b4a6bdac7 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;