components/openssl: change SSL read or write statement after success

This commit is contained in:
Dong Heng 2016-10-09 19:18:18 +08:00
parent 37a68ad605
commit 034da95abb

View file

@ -390,6 +390,7 @@ int SSL_read(SSL *ssl, void *buffer, int len)
ret = SSL_METHOD_CALL(read, ssl, buffer, len); ret = SSL_METHOD_CALL(read, ssl, buffer, len);
if (ret == len)
ssl->rwstate = SSL_NOTHING; ssl->rwstate = SSL_NOTHING;
return ret; return ret;
@ -428,12 +429,10 @@ int SSL_write(SSL *ssl, const void *buffer, int len)
} }
} while (ret > 0 && send_bytes); } while (ret > 0 && send_bytes);
if (ret >= 0) {
ret = len - send_bytes;
ssl->rwstate = SSL_NOTHING; ssl->rwstate = SSL_NOTHING;
} else
send_bytes = len - send_bytes;
if (send_bytes >= 0)
ret = send_bytes;
else
ret = -1; ret = -1;
return ret; return ret;