On Mon, 13 Jun 2011, Anton Khirnov wrote:

> From: Michael Niedermayer <[email protected]>
> 
> Signed-off-by: Michael Niedermayer <[email protected]>
> Signed-off-by: Anton Khirnov <[email protected]>
> ---
>  libavformat/tcp.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/libavformat/tcp.c b/libavformat/tcp.c
> index e602a55..1c8db07 100644
> --- a/libavformat/tcp.c
> +++ b/libavformat/tcp.c
> @@ -97,6 +97,7 @@ static int tcp_open(URLContext *h, const char *uri, int 
> flags)
>      }
>  
>      if (ret < 0) {
> +        int timeout=50;
>          struct pollfd p = {fd, POLLOUT, 0};
>          ret = ff_neterrno();
>          if (ret == AVERROR(EINTR)) {
> @@ -119,6 +120,12 @@ static int tcp_open(URLContext *h, const char *uri, int 
> flags)
>              ret = poll(&p, 1, 100);
>              if (ret > 0)
>                  break;
> +            if(!--timeout){
> +                av_log(NULL, AV_LOG_ERROR,
> +                    "TCP open %s:%d timeout\n",
> +                    hostname, port);
> +                goto fail;
> +            }
>          }
>          if (ret <= 0) {
>              ret = AVERROR(ETIMEDOUT);
> -- 
> 1.7.5.3

We already have a timeout in the tcp connect phase now (which additionally 
is configurable), so I don't think this cherry-pick is needed, or is it?

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to