OSDN Git Service
(root)
/
coroid
/
ffmpeg_saccubus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ecf9498
)
Timeout TCP open() after 5 seconds.
author
Michael Niedermayer
<michaelni@gmx.at>
Fri, 1 Apr 2011 22:29:07 +0000
(
00:29
+0200)
committer
Michael Niedermayer
<michaelni@gmx.at>
Fri, 1 Apr 2011 22:56:43 +0000
(
00:56
+0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/tcp.c
patch
|
blob
|
history
diff --git
a/libavformat/tcp.c
b/libavformat/tcp.c
index
83529df
..
fb94b63
100644
(file)
--- a/
libavformat/tcp.c
+++ b/
libavformat/tcp.c
@@
-71,6
+71,7
@@
static int tcp_open(URLContext *h, const char *uri, int flags)
redo:
ret = connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
if (ret < 0) {
+ int timeout=50;
struct pollfd p = {fd, POLLOUT, 0};
if (ff_neterrno() == AVERROR(EINTR)) {
if (url_interrupt_cb()) {
@@
-92,6
+93,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;
+ }
}
/* test error */