mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge commit 'abe5268c3328bf0e8fcfb7dc6e231b8920177c3a'
* commit 'abe5268c3328bf0e8fcfb7dc6e231b8920177c3a': tcp: Use a different log message and level if there's more addresses to try Conflicts: libavformat/tcp.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
89efaabc99
@ -267,7 +267,8 @@ int ff_listen_bind(int fd, const struct sockaddr *addr,
|
||||
}
|
||||
|
||||
int ff_listen_connect(int fd, const struct sockaddr *addr,
|
||||
socklen_t addrlen, int timeout, URLContext *h)
|
||||
socklen_t addrlen, int timeout, URLContext *h,
|
||||
int will_try_next)
|
||||
{
|
||||
struct pollfd p = {fd, POLLOUT, 0};
|
||||
int ret;
|
||||
@ -294,9 +295,13 @@ int ff_listen_connect(int fd, const struct sockaddr *addr,
|
||||
char errbuf[100];
|
||||
ret = AVERROR(ret);
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
av_log(h, AV_LOG_ERROR,
|
||||
"Connection to %s failed: %s\n",
|
||||
h->filename, errbuf);
|
||||
if (will_try_next)
|
||||
av_log(h, AV_LOG_WARNING,
|
||||
"Connection to %s failed (%s), trying next address\n",
|
||||
h->filename, errbuf);
|
||||
else
|
||||
av_log(h, AV_LOG_ERROR, "Connection to %s failed: %s\n",
|
||||
h->filename, errbuf);
|
||||
}
|
||||
default:
|
||||
return ret;
|
||||
|
@ -251,11 +251,14 @@ int ff_listen_bind(int fd, const struct sockaddr *addr,
|
||||
* @param timeout Polling timeout in milliseconds.
|
||||
* @param h URLContext providing interrupt check
|
||||
* callback and logging context.
|
||||
* @param will_try_next Whether the caller will try to connect to another
|
||||
* address for the same host name, affecting the form of
|
||||
* logged errors.
|
||||
* @return 0 on success, AVERROR on failure.
|
||||
*/
|
||||
int ff_listen_connect(int fd, const struct sockaddr *addr,
|
||||
socklen_t addrlen, int timeout,
|
||||
URLContext *h);
|
||||
URLContext *h, int will_try_next);
|
||||
|
||||
int ff_http_match_no_proxy(const char *no_proxy, const char *hostname);
|
||||
|
||||
|
@ -127,7 +127,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
|
||||
}
|
||||
} else {
|
||||
if ((ret = ff_listen_connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen,
|
||||
s->open_timeout / 1000, h)) < 0) {
|
||||
s->open_timeout / 1000, h, cur_ai->ai_next)) < 0) {
|
||||
|
||||
if (ret == AVERROR_EXIT)
|
||||
goto fail1;
|
||||
|
@ -83,7 +83,7 @@ static int unix_open(URLContext *h, const char *filename, int flags)
|
||||
}
|
||||
} else {
|
||||
ret = ff_listen_connect(fd, (struct sockaddr *)&s->addr,
|
||||
sizeof(s->addr), s->timeout, h);
|
||||
sizeof(s->addr), s->timeout, h, 0);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user