| 93 | } |
| 94 | |
| 95 | void NetRequest::DoTransfer() |
| 96 | { |
| 97 | if (mCancelling) |
| 98 | return; |
| 99 | |
| 100 | // { |
| 101 | // mFailed = true; |
| 102 | // return; |
| 103 | // } |
| 104 | |
| 105 | long response_code = 0; |
| 106 | for (int pass = 0; pass < 3; pass++) |
| 107 | { |
| 108 | BfLogDbg("NetManager starting get on %s Pass:%d\n", mURL.c_str(), pass); |
| 109 | mNetManager->mDebugManager->OutputRawMessage(StrFormat("msgLo Getting '%s'\n", mURL.c_str())); |
| 110 | |
| 111 | mOutTempPath = mOutPath + "__partial"; |
| 112 | |
| 113 | mCURLMulti = curl_multi_init(); |
| 114 | |
| 115 | mCURL = curl_easy_init(); |
| 116 | |
| 117 | if (mShowTracking) |
| 118 | { |
| 119 | mNetManager->mDebugManager->OutputRawMessage(StrFormat("symsrv Getting '%s'", mURL.c_str())); |
| 120 | } |
| 121 | |
| 122 | //OutputDebugStrF("Getting '%s'\n", mURL.c_str()); |
| 123 | |
| 124 | curl_easy_setopt(mCURL, CURLOPT_URL, mURL.c_str()); |
| 125 | curl_easy_setopt(mCURL, CURLOPT_WRITEDATA, (void*)this); |
| 126 | curl_easy_setopt(mCURL, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); |
| 127 | curl_easy_setopt(mCURL, CURLOPT_XFERINFODATA, (void*)this); |
| 128 | curl_easy_setopt(mCURL, CURLOPT_XFERINFOFUNCTION, TransferInfoCallback); |
| 129 | curl_easy_setopt(mCURL, CURLOPT_FOLLOWLOCATION, 1L); |
| 130 | curl_easy_setopt(mCURL, CURLOPT_NOPROGRESS, 0L); |
| 131 | curl_easy_setopt(mCURL, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); // Connects go slow without this |
| 132 | //auto result = curl_easy_perform(mCURL); |
| 133 | |
| 134 | CURLMcode mcode = curl_multi_add_handle(mCURLMulti, mCURL); |
| 135 | if (mcode != CURLM_OK) |
| 136 | { |
| 137 | mFailed = true; |
| 138 | return; |
| 139 | } |
| 140 | |
| 141 | while (true) |
| 142 | { |
| 143 | int activeCount = 0; |
| 144 | curl_multi_perform(mCURLMulti, &activeCount); |
| 145 | if (activeCount == 0) |
| 146 | break; |
| 147 | |
| 148 | int waitRet = 0; |
| 149 | curl_multi_wait(mCURLMulti, NULL, 0, 20, &waitRet); |
| 150 | |
| 151 | if (mCancelling) |
| 152 | { |
nothing calls this directly
no test coverage detected