tls: Return AVERROR_EOF if the TLS_read/write functions return 0
authorMartin Storsjö <martin@martin.st>
Fri, 27 Jul 2012 17:22:51 +0000 (20:22 +0300)
committerMartin Storsjö <martin@martin.st>
Fri, 27 Jul 2012 22:21:16 +0000 (01:21 +0300)
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@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/tls.c

index fb84fa8..866e55f 100644 (file)
@@ -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;
     }