From 034da95abb17974e5ed7ec0bfa9d1ba629636986 Mon Sep 17 00:00:00 2001 From: Dong Heng Date: Sun, 9 Oct 2016 19:18:18 +0800 Subject: [PATCH] components/openssl: change SSL read or write statement after success --- components/openssl/library/ssl_lib.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/components/openssl/library/ssl_lib.c b/components/openssl/library/ssl_lib.c index 267d23f25f..9740282d13 100644 --- a/components/openssl/library/ssl_lib.c +++ b/components/openssl/library/ssl_lib.c @@ -390,7 +390,8 @@ int SSL_read(SSL *ssl, void *buffer, int len) ret = SSL_METHOD_CALL(read, ssl, buffer, len); - ssl->rwstate = SSL_NOTHING; + if (ret == len) + ssl->rwstate = SSL_NOTHING; return ret; } @@ -428,12 +429,10 @@ int SSL_write(SSL *ssl, const void *buffer, int len) } } while (ret > 0 && send_bytes); - ssl->rwstate = SSL_NOTHING; - - send_bytes = len - send_bytes; - if (send_bytes >= 0) - ret = send_bytes; - else + if (ret >= 0) { + ret = len - send_bytes; + ssl->rwstate = SSL_NOTHING; + } else ret = -1; return ret; -- 2.40.0