updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / curl-hphp / libcurl.fb-changes.diff
blob5b64a8395e07d2a249124c4fffdc36d7441a653e
1 Index: include/curl/multi.h
2 ===================================================================
3 RCS file: /cvsroot/curl/curl/include/curl/multi.h,v
4 retrieving revision 1.45
5 diff -u -r1.45 multi.h
6 --- curl-old/include/curl/multi.h 20 May 2008 10:21:50 -0000 1.45
7 +++ curl-new/include/curl/multi.h 29 Jan 2010 23:45:18 -0000
8 @@ -135,6 +135,19 @@
9 int *max_fd);
12 + * Name: curl_multi_select()
13 + *
14 + * Desc: Calls select() or poll() internally so app can call
15 + * curl_multi_perform() as soon as one of them is ready. This is to
16 + * fix FD_SETSIZE problem curl_multi_fdset() has.
17 + *
18 + * Returns: CURLMcode type, general multi error code.
19 + */
20 +CURL_EXTERN CURLMcode curl_multi_select(CURLM *multi_handle,
21 + int timeout_ms,
22 + int *ret);
24 + /*
25 * Name: curl_multi_perform()
27 * Desc: When the app thinks there's data available for curl it calls this
28 Index: lib/multi.c
29 ===================================================================
30 RCS file: /cvsroot/curl/curl/lib/multi.c,v
31 retrieving revision 1.210
32 diff -u -r1.210 multi.c
33 --- curl-old/lib/multi.c 28 Jan 2010 15:34:18 -0000 1.210
34 +++ curl-new/lib/multi.c 29 Jan 2010 23:45:19 -0000
35 @@ -42,6 +42,7 @@
36 #include "sendf.h"
37 #include "timeval.h"
38 #include "http.h"
39 +#include "select.h"
41 #define _MPRINTF_REPLACE /* use our functions only */
42 #include <curl/mprintf.h>
43 @@ -900,6 +901,80 @@
44 return CURLM_OK;
47 +CURLMcode curl_multi_select(CURLM *multi_handle, int timeout_ms, int *ret) {
48 + struct Curl_multi *multi=(struct Curl_multi *)multi_handle;
49 + struct Curl_one_easy *easy;
50 + curl_socket_t sockbunch[MAX_SOCKSPEREASYHANDLE];
51 + int bitmap;
52 + int i;
53 + unsigned int nfds = 0;
54 + struct pollfd *ufds;
55 + int nret = -1;
57 + if(!GOOD_MULTI_HANDLE(multi))
58 + return CURLM_BAD_HANDLE;
60 + easy=multi->easy.next;
61 + while(easy != &multi->easy) {
62 + bitmap = multi_getsock(easy, sockbunch, MAX_SOCKSPEREASYHANDLE);
64 + for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++) {
65 + curl_socket_t s = CURL_SOCKET_BAD;
67 + if(bitmap & GETSOCK_READSOCK(i)) {
68 + ++nfds;
69 + s = sockbunch[i];
70 + }
71 + if(bitmap & GETSOCK_WRITESOCK(i)) {
72 + ++nfds;
73 + s = sockbunch[i];
74 + }
75 + if(s == CURL_SOCKET_BAD) {
76 + break;
77 + }
78 + }
80 + easy = easy->next; /* check next handle */
81 + }
83 + ufds = (struct pollfd *)malloc(nfds * sizeof(struct pollfd));
84 + nfds = 0;
86 + easy=multi->easy.next;
87 + while(easy != &multi->easy) {
88 + bitmap = multi_getsock(easy, sockbunch, MAX_SOCKSPEREASYHANDLE);
90 + for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++) {
91 + curl_socket_t s = CURL_SOCKET_BAD;
93 + if(bitmap & GETSOCK_READSOCK(i)) {
94 + ufds[nfds].fd = sockbunch[i];
95 + ufds[nfds].events = POLLIN;
96 + ++nfds;
97 + s = sockbunch[i];
98 + }
99 + if(bitmap & GETSOCK_WRITESOCK(i)) {
100 + ufds[nfds].fd = sockbunch[i];
101 + ufds[nfds].events = POLLOUT;
102 + ++nfds;
103 + s = sockbunch[i];
105 + if(s == CURL_SOCKET_BAD) {
106 + break;
110 + easy = easy->next; /* check next handle */
113 + nret = Curl_poll(ufds, nfds, timeout_ms);
114 + free(ufds);
115 + if (ret) {
116 + *ret = nret;
118 + return CURLM_OK;
121 static CURLMcode multi_runsingle(struct Curl_multi *multi,
122 struct Curl_one_easy *easy)