aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2018-04-18 14:09:19 +0200
committerHendrik Leppkes <h.leppkes@gmail.com>2018-04-19 13:27:49 +0200
commit0b6de235b98ca3076e85adebc922b25df79080b7 (patch)
tree428f8be8cd51f92db8b656ba08e872b59594f632
parenta73b464118a71483241d3120c05e2b3bd871bb44 (diff)
downloadffmpeg-0b6de235b98ca3076e85adebc922b25df79080b7.tar.gz
avformat/tls_schannel: fix handling of EOF after avio changes
(cherry picked from commit 5c6365af454fb24f20d753ed99dd8e2b60e85035)
-rw-r--r--libavformat/tls_schannel.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavformat/tls_schannel.c b/libavformat/tls_schannel.c
index 9a6e0c92e3..f41b007773 100644
--- a/libavformat/tls_schannel.c
+++ b/libavformat/tls_schannel.c
@@ -413,11 +413,13 @@ static int tls_read(URLContext *h, uint8_t *buf, int len)
ret = ffurl_read(s->tcp, c->enc_buf + c->enc_buf_offset,
c->enc_buf_size - c->enc_buf_offset);
- if (ret < 0) {
+ if (ret == AVERROR_EOF) {
+ c->connection_closed = 1;
+ ret = 0;
+ } else if (ret < 0) {
av_log(h, AV_LOG_ERROR, "Unable to read from socket\n");
return ret;
- } else if (ret == 0)
- c->connection_closed = 1;
+ }
c->enc_buf_offset += ret;
}
@@ -515,7 +517,7 @@ cleanup:
if (ret == 0 && !c->connection_closed)
ret = AVERROR(EAGAIN);
- return ret < 0 ? ret : 0;
+ return ret < 0 ? ret : AVERROR_EOF;
}
static int tls_write(URLContext *h, const uint8_t *buf, int len)