Merge commit 'd13b124eaf452b267480074b2e6946538ed03a6e'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 22 May 2015 00:37:23 +0000 (02:37 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 22 May 2015 00:38:11 +0000 (02:38 +0200)
* commit 'd13b124eaf452b267480074b2e6946538ed03a6e':
  tls: Remove the nonblocking code

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/tls.c

@@@ -217,43 -214,9 +215,34 @@@ static int do_tls_poll(URLContext *h, i
          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)
 +{
 +    TLSContext *c = h->priv_data;
 +    char buf[1024];
 +    const char *p = strchr(uri, '?');
 +    if (!p)
 +        return;
 +
 +    if (!c->ca_file && av_find_info_tag(buf, sizeof(buf), "cafile", p))
 +        c->ca_file = av_strdup(buf);
 +
 +    if (!c->verify && av_find_info_tag(buf, sizeof(buf), "verify", p)) {
 +        char *endptr = NULL;
 +        c->verify = strtol(buf, &endptr, 10);
 +        if (buf == endptr)
 +            c->verify = 1;
 +    }
 +
 +    if (!c->cert_file && av_find_info_tag(buf, sizeof(buf), "cert", p))
 +        c->cert_file = av_strdup(buf);
 +
 +    if (!c->key_file && av_find_info_tag(buf, sizeof(buf), "key", p))
 +        c->key_file = av_strdup(buf);
 +}
 +
  static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **options)
  {
      TLSContext *c = h->priv_data;
              ret = AVERROR(EIO);
              goto fail;
          }
 -    }
 +    } 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);