summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2015-05-22 12:53:52 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2015-05-22 12:53:52 -0400
commit2540487fcd06544fbdcda37944bde344df877e47 (patch)
tree5cb1d0e8f12426aac4ab070cbe889b07f3998983 /src
parentca183d27366ba75597a9806b746e42a074df7795 (diff)
parent77bffc2cd60277b95e004d7c22814d7f0e5a5838 (diff)
downloadlibgit2-2540487fcd06544fbdcda37944bde344df877e47.tar.gz
Merge pull request #3108 from libgit2/cmn/ssl-no-want
openssl: don't try to handle WANT_READ or WANT_WRITE
Diffstat (limited to 'src')
-rw-r--r--src/openssl_stream.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/openssl_stream.c b/src/openssl_stream.c
index a975bb0c1..9b2d5951c 100644
--- a/src/openssl_stream.c
+++ b/src/openssl_stream.c
@@ -291,19 +291,14 @@ ssize_t openssl_write(git_stream *stream, const char *data, size_t len, int flag
{
openssl_stream *st = (openssl_stream *) stream;
int ret;
- size_t off = 0;
GIT_UNUSED(flags);
- while (off < len) {
- ret = SSL_write(st->ssl, data + off, len - off);
- if (ret <= 0 && ret != SSL_ERROR_WANT_WRITE)
- return ssl_set_error(st->ssl, ret);
-
- off += ret;
- }
+ if ((ret = SSL_write(st->ssl, data, len)) <= 0) {
+ return ssl_set_error(st->ssl, ret);
+ }
- return off;
+ return ret;
}
ssize_t openssl_read(git_stream *stream, void *data, size_t len)
@@ -311,14 +306,8 @@ ssize_t openssl_read(git_stream *stream, void *data, size_t len)
openssl_stream *st = (openssl_stream *) stream;
int ret;
- do {
- ret = SSL_read(st->ssl, data, len);
- } while (SSL_get_error(st->ssl, ret) == SSL_ERROR_WANT_READ);
-
- if (ret < 0) {
+ if ((ret = SSL_read(st->ssl, data, len)) <= 0)
ssl_set_error(st->ssl, ret);
- return -1;
- }
return ret;
}