diff options
Diffstat (limited to 'src/curl/curl_reschedule.c')
-rw-r--r-- | src/curl/curl_reschedule.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/curl/curl_reschedule.c b/src/curl/curl_reschedule.c index 1b0f2e440..354ba13df 100644 --- a/src/curl/curl_reschedule.c +++ b/src/curl/curl_reschedule.c | |||
@@ -28,9 +28,9 @@ | |||
28 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
29 | 29 | ||
30 | extern void * | 30 | extern void * |
31 | download_get_result (struct GNUNET_CURL_DownloadBuffer *db, | 31 | GNUNET_CURL_download_get_result_ (struct GNUNET_CURL_DownloadBuffer *db, |
32 | CURL *eh, | 32 | CURL *eh, |
33 | long *response_code); | 33 | long *response_code); |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Closure for #GNUNET_CURL_gnunet_scheduler_reschedule(). | 36 | * Closure for #GNUNET_CURL_gnunet_scheduler_reschedule(). |
@@ -105,7 +105,7 @@ GNUNET_CURL_gnunet_rc_create (struct GNUNET_CURL_Context *ctx) | |||
105 | 105 | ||
106 | rc = GNUNET_new (struct GNUNET_CURL_RescheduleContext); | 106 | rc = GNUNET_new (struct GNUNET_CURL_RescheduleContext); |
107 | rc->ctx = ctx; | 107 | rc->ctx = ctx; |
108 | rc->parser = &download_get_result; | 108 | rc->parser = &GNUNET_CURL_download_get_result_; |
109 | rc->cleaner = &clean_result; | 109 | rc->cleaner = &clean_result; |
110 | return rc; | 110 | return rc; |
111 | } | 111 | } |
@@ -145,9 +145,7 @@ context_task (void *cls) | |||
145 | 145 | ||
146 | rc->task = NULL; | 146 | rc->task = NULL; |
147 | 147 | ||
148 | GNUNET_CURL_perform2 (rc->ctx, | 148 | GNUNET_CURL_perform2 (rc->ctx, rc->parser, rc->cleaner); |
149 | rc->parser, | ||
150 | rc->cleaner); | ||
151 | max_fd = -1; | 149 | max_fd = -1; |
152 | timeout = -1; | 150 | timeout = -1; |
153 | FD_ZERO (&read_fd_set); | 151 | FD_ZERO (&read_fd_set); |
@@ -160,18 +158,14 @@ context_task (void *cls) | |||
160 | &max_fd, | 158 | &max_fd, |
161 | &timeout); | 159 | &timeout); |
162 | if (timeout >= 0) | 160 | if (timeout >= 0) |
163 | delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, | 161 | delay = |
164 | timeout); | 162 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, timeout); |
165 | else | 163 | else |
166 | delay = GNUNET_TIME_UNIT_FOREVER_REL; | 164 | delay = GNUNET_TIME_UNIT_FOREVER_REL; |
167 | rs = GNUNET_NETWORK_fdset_create (); | 165 | rs = GNUNET_NETWORK_fdset_create (); |
168 | GNUNET_NETWORK_fdset_copy_native (rs, | 166 | GNUNET_NETWORK_fdset_copy_native (rs, &read_fd_set, max_fd + 1); |
169 | &read_fd_set, | ||
170 | max_fd + 1); | ||
171 | ws = GNUNET_NETWORK_fdset_create (); | 167 | ws = GNUNET_NETWORK_fdset_create (); |
172 | GNUNET_NETWORK_fdset_copy_native (ws, | 168 | GNUNET_NETWORK_fdset_copy_native (ws, &write_fd_set, max_fd + 1); |
173 | &write_fd_set, | ||
174 | max_fd + 1); | ||
175 | if (NULL == rc->task) | 169 | if (NULL == rc->task) |
176 | rc->task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 170 | rc->task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
177 | delay, | 171 | delay, |
@@ -196,12 +190,11 @@ context_task (void *cls) | |||
196 | void | 190 | void |
197 | GNUNET_CURL_gnunet_scheduler_reschedule (void *cls) | 191 | GNUNET_CURL_gnunet_scheduler_reschedule (void *cls) |
198 | { | 192 | { |
199 | struct GNUNET_CURL_RescheduleContext *rc = *(void**) cls; | 193 | struct GNUNET_CURL_RescheduleContext *rc = *(void **) cls; |
200 | 194 | ||
201 | if (NULL != rc->task) | 195 | if (NULL != rc->task) |
202 | GNUNET_SCHEDULER_cancel (rc->task); | 196 | GNUNET_SCHEDULER_cancel (rc->task); |
203 | rc->task = GNUNET_SCHEDULER_add_now (&context_task, | 197 | rc->task = GNUNET_SCHEDULER_add_now (&context_task, rc); |
204 | rc); | ||
205 | } | 198 | } |
206 | 199 | ||
207 | /* end of curl_reschedule.c */ | 200 | /* end of curl_reschedule.c */ |