summaryrefslogtreecommitdiff
path: root/libavformat/tcp.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2010-08-14 20:34:51 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2010-08-14 20:34:51 +0000
commit63638a3c4a6c8fec03e121a0bfbfa555ff6d4956 (patch)
tree37aa38aa9f2af5578924ca6c29606af7f10e90b4 /libavformat/tcp.c
parentafbc4d2dac0434f645bbce80d5a47e11e4d6d5fb (diff)
Print error messages in case of connection failure or name resolution failure
in tcp.c. Originally committed as revision 24796 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/tcp.c')
-rw-r--r--libavformat/tcp.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 1827aa00a7..ca4a6b0b25 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -54,8 +54,13 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
snprintf(portstr, sizeof(portstr), "%d", port);
- if (getaddrinfo(hostname, portstr, &hints, &ai))
+ ret = getaddrinfo(hostname, portstr, &hints, &ai);
+ if (ret) {
+ av_log(NULL, AV_LOG_ERROR,
+ "Failed to resolve hostname %s: %s\n",
+ hostname, gai_strerror(ret));
return AVERROR(EIO);
+ }
cur_ai = ai;
@@ -93,8 +98,12 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
/* test error */
optlen = sizeof(ret);
getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen);
- if (ret != 0)
+ if (ret != 0) {
+ av_log(NULL, AV_LOG_ERROR,
+ "TCP connection to %s:%d failed: %s\n",
+ hostname, port, strerror(ret));
goto fail;
+ }
}
s = av_malloc(sizeof(TCPContext));
if (!s) {