[FFmpeg-cvslog] tls: Return AVERROR_EOF if the TLS_read/write functions return 0

Martin Storsjö git at videolan.org
Sun Jul 29 02:26:19 CEST 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Fri Jul 27 20:22:51 2012 +0300| [41ecbbc7aa3d491cc9d8d425634c5901eefa088a] | committer: Martin Storsjö

tls: Return AVERROR_EOF if the TLS_read/write functions return 0

OpenSSL returns 0 when the peer has closed the connection. GnuTLS
doesn't return that though, but returns
GNUTLS_E_UNEXPECTED_PACKET_LENGTH if the connection simply is closed
without a clean close notify packet.

Tested-by: Antti Seppälä <a.seppala at gmail.com>
Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=41ecbbc7aa3d491cc9d8d425634c5901eefa088a
---

 libavformat/tls.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/tls.c b/libavformat/tls.c
index fb84fa8..866e55f 100644
--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -209,7 +209,7 @@ static int tls_read(URLContext *h, uint8_t *buf, int size)
         if (ret > 0)
             return ret;
         if (ret == 0)
-            return AVERROR(EIO);
+            return AVERROR_EOF;
         if ((ret = do_tls_poll(h, ret)) < 0)
             return ret;
     }
@@ -224,7 +224,7 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size)
         if (ret > 0)
             return ret;
         if (ret == 0)
-            return AVERROR(EIO);
+            return AVERROR_EOF;
         if ((ret = do_tls_poll(h, ret)) < 0)
             return ret;
     }



More information about the ffmpeg-cvslog mailing list