17 Jun 2012 23:58
[PATCH] TCP: Use AI_PASSIVE flag when no address is set
---
libavformat/tcp.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 7e348f7..c9ff47a 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
<at> <at> -65,7 +65,12 <at> <at> 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);
- ret = getaddrinfo(hostname, portstr, &hints, &ai);
+ if (listen_socket && !hostname[0]) {
+ hints.ai_flags |= AI_PASSIVE;
+ ret = getaddrinfo(NULL, portstr, &hints, &ai);
+ }
+ else
+ ret = getaddrinfo(hostname, portstr, &hints, &ai);
if (ret) {
av_log(h, AV_LOG_ERROR,
"Failed to resolve hostname %s: %s\n",
--
--
1.7.10
RSS Feed