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,7 +390,8 @@ 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);
ssl->rwstate = SSL_NOTHING; if (ret == len)
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);
ssl->rwstate = SSL_NOTHING; if (ret >= 0) {
ret = len - send_bytes;
send_bytes = len - send_bytes; ssl->rwstate = SSL_NOTHING;
if (send_bytes >= 0) } else
ret = send_bytes;
else
ret = -1; ret = -1;
return ret; return ret;