159{
160#ifndef NETWORK_MOCK
161 DownloadOperation *download;
162 int still_alive = 1;
163 int msgs_left = -1;
164
165 CURLMsg *msg;
166
167 curl_multi_perform(cm, &still_alive);
168
169
170 while((msg = curl_multi_info_read(cm, &msgs_left)))
171 {
172 long response_code = 404;
173
174 if (msg->msg != CURLMSG_DONE)
175 continue;
176
177 curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, &download);
178 curl_easy_getinfo(msg->easy_handle, CURLINFO_RESPONSE_CODE, &response_code);
179
180 transferFinish(download);
181 startTransfersFromQueue();
182
183 if (response_code == 200)
184 download->status = DownloadStatus::COMPLETE;
185 else
186 download->status = DownloadStatus::FAILED;
187
188 download->cb(download);
189 }
190
191 startTransfersFromQueue();
192
193 return ((still_alive) || (msgs_left > 0) || (queue.size() > 0));
194#else
195 return false;
196#endif
197}