summaryrefslogtreecommitdiff
path: root/extra/moc/curl-streams.diff
blob: 2dbc38d541394ff6bf163cc632c6dd813772fed4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
diff -u moc-2.4.4/io_curl.c moc-2.4.4/io_curl.c
--- a/io_curl.c	2007-07-08 08:54:45.000000000 +0200
+++ b/io_curl.c	2011-05-18 09:09:40.000000000 +0200
@@ -338,6 +338,8 @@
 			fd_set read_fds, write_fds, exc_fds;
 			int max_fd;
 			int ret;
+         long milliseconds;
+         struct timeval timeout;
 
 			logit ("Doing select()...");
 
@@ -356,8 +358,14 @@
 			if (s->curl.wake_up_pipe[0] > max_fd)
 				max_fd = s->curl.wake_up_pipe[0];
 
+         curl_multi_timeout(s->curl.multi_handle, &milliseconds);
+         if(milliseconds <= 0)
+           milliseconds = 1000; /* just a cautionary default */
+         timeout.tv_sec = milliseconds / 1000;
+         timeout.tv_usec = (milliseconds % 1000) * 1000;
+
 			ret = select (max_fd + 1, &read_fds, &write_fds,
-					&exc_fds, NULL);
+					&exc_fds, &timeout);
 
 			if (ret < 0 && errno == EINTR) {
 				logit ("Interrupted");