diff options
author | Martin Storsjö <martin@martin.st> | 2013-08-05 19:44:20 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-08-06 10:39:39 +0300 |
commit | abe5268c3328bf0e8fcfb7dc6e231b8920177c3a (patch) | |
tree | 653381611587be59fbaf17994872adf58f353a4d /libavformat/network.c | |
parent | 2a0ec47bd70ebb79e8b2d2f956feeb3a813df798 (diff) | |
download | ffmpeg-abe5268c3328bf0e8fcfb7dc6e231b8920177c3a.tar.gz |
tcp: Use a different log message and level if there's more addresses to try
This lowers the level of warnings printed if trying to connect
to a host name that provides both v6 and v4 addresses but the
service only is available on the v4 address (often occurring for
'localhost', with servers that aren't v6-aware).
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/network.c')
-rw-r--r-- | libavformat/network.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libavformat/network.c b/libavformat/network.c index d8e6540b19..810a907212 100644 --- a/libavformat/network.c +++ b/libavformat/network.c @@ -240,7 +240,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; @@ -267,9 +268,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; |