diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-05-22 02:37:23 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-05-22 02:38:11 +0200 |
commit | 9221e362fd3b4821db5a79cb2d04a12c715235de (patch) | |
tree | 9f18e8f3e14dbce2e9eba29c4e42fcac9d1f1ebe | |
parent | 162644c8331df0ba4e45bf77262f09d2ed98a2e6 (diff) | |
parent | d13b124eaf452b267480074b2e6946538ed03a6e (diff) | |
download | ffmpeg-9221e362fd3b4821db5a79cb2d04a12c715235de.tar.gz |
Merge commit 'd13b124eaf452b267480074b2e6946538ed03a6e'
* commit 'd13b124eaf452b267480074b2e6946538ed03a6e':
tls: Remove the nonblocking code
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/tls.c | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/libavformat/tls.c b/libavformat/tls.c index 77b932c397..ca5a627000 100644 --- a/libavformat/tls.c +++ b/libavformat/tls.c @@ -47,10 +47,9 @@ static ssize_t gnutls_url_pull(gnutls_transport_ptr_t transport, int ret = ffurl_read(h, buf, len); if (ret >= 0) return ret; - if (ret == AVERROR(EAGAIN)) - errno = EAGAIN; - else - errno = EIO; + if (ret == AVERROR_EXIT) + return 0; + errno = EIO; return -1; } static ssize_t gnutls_url_push(gnutls_transport_ptr_t transport, @@ -60,10 +59,9 @@ static ssize_t gnutls_url_push(gnutls_transport_ptr_t transport, int ret = ffurl_write(h, buf, len); if (ret >= 0) return ret; - if (ret == AVERROR(EAGAIN)) - errno = EAGAIN; - else - errno = EIO; + if (ret == AVERROR_EXIT) + return 0; + errno = EIO; return -1; } #elif CONFIG_OPENSSL @@ -100,8 +98,8 @@ static int url_bio_bread(BIO *b, char *buf, int len) if (ret >= 0) return ret; BIO_clear_retry_flags(b); - if (ret == AVERROR(EAGAIN)) - BIO_set_retry_read(b); + if (ret == AVERROR_EXIT) + return 0; return -1; } @@ -112,8 +110,8 @@ static int url_bio_bwrite(BIO *b, const char *buf, int len) if (ret >= 0) return ret; BIO_clear_retry_flags(b); - if (ret == AVERROR(EAGAIN)) - BIO_set_retry_write(b); + if (ret == AVERROR_EXIT) + return 0; return -1; } @@ -217,16 +215,7 @@ static int do_tls_poll(URLContext *h, int ret) return AVERROR(EIO); } #endif - if (h->flags & AVIO_FLAG_NONBLOCK) - return AVERROR(EAGAIN); - while (1) { - int n = poll(&p, 1, 100); - if (n > 0) - break; - if (ff_check_interrupt(&h->interrupt_callback)) - return AVERROR(EINTR); - } - return 0; + return AVERROR(EIO); } static void set_options(URLContext *h, const char *uri) @@ -346,7 +335,6 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op } else if (c->cert_file || c->key_file) av_log(h, AV_LOG_ERROR, "cert and key required\n"); gnutls_credentials_set(c->session, GNUTLS_CRD_CERTIFICATE, c->cred); - c->tcp->flags |= AVIO_FLAG_NONBLOCK; gnutls_transport_set_pull_function(c->session, gnutls_url_pull); gnutls_transport_set_push_function(c->session, gnutls_url_push); gnutls_transport_set_ptr(c->session, c->tcp); @@ -425,7 +413,6 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op goto fail; } bio = BIO_new(&url_bio_method); - c->tcp->flags |= AVIO_FLAG_NONBLOCK; bio->ptr = c->tcp; SSL_set_bio(c->ssl, bio, bio); if (!c->listen && !numerichost) |