void XMLHttpRequest::curl_multiperform() { int still_running = 0; do { CURLMcode code = CURLM_OK; // If code is CURLM_CALL_MULTI_PERFORM we must call curl_multi_perform again immediately. while((code = curl_multi_perform(curlm, &still_running))==CURLM_CALL_MULTI_PERFORM); if(code==CURLM_OK) { // Ask the multi handle if there are any messages from the individual transfers. int msgs_in_queue = 0; CURLMsg* cmsg = curl_multi_info_read(curlm, &msgs_in_queue); if(cmsg && cmsg->msg == CURLMSG_DONE) { XMLHttpRequest* t = nullptr; curl_easy_getinfo(cmsg->easy_handle, CURLINFO_PRIVATE, reinterpret_cast<char**>(&t)); switch(cmsg->data.result) { case CURLE_OK: t->curl_complete(); break; } } } } while(still_running); }