diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2015-05-22 12:53:52 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-05-22 12:53:52 -0400 |
commit | 2540487fcd06544fbdcda37944bde344df877e47 (patch) | |
tree | 5cb1d0e8f12426aac4ab070cbe889b07f3998983 /src | |
parent | ca183d27366ba75597a9806b746e42a074df7795 (diff) | |
parent | 77bffc2cd60277b95e004d7c22814d7f0e5a5838 (diff) | |
download | libgit2-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.c | 21 |
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; } |