Clone
ixen <ixen@copyhandler.com>
committed
on 06 Jan 16
Added support for changing settings from within the updater dialog. Tuned the way updates are displayed in updater dialog (CH-209).
LoggerImprovements + 5 more
src/ch/AsyncHttpFile.cpp (+6 -2)
255 255         SetErrorCode(ERROR_SUCCESS);
256 256         if(m_hOpenUrl)
257 257         {
258 258                 m_dwExpectedState = INTERNET_STATUS_CLOSING_CONNECTION;
259 259                 if(!::InternetCloseHandle(m_hOpenUrl))
260 260                 {
261 261                         SetErrorCode(::GetLastError());
262 262                         if(GetErrorCode() == ERROR_IO_PENDING)
263 263                                 return S_FALSE;
264 264                         else
265 265                         {
266 266                                 SetErrorCode(ERROR_INTERNAL_ERROR);
267 267                                 return E_FAIL;
268 268                         }
269 269                 }
270 270
271 271                 // if closing url handle succeeded, we close internet here, if not
272 272                 // then a separate call to close need to be performed.
273 273                 m_dwExpectedState = 0;
274 274                 SetUrlHandle(NULL);
  275                 if(m_hInternet != nullptr)
  276                 {
275 277                         ::InternetCloseHandle(m_hInternet);
  278                         m_hInternet = nullptr;
276 279                 }
  280         }
277 281
278 282         if(m_hFinishedEvent)
279 283         {
280 284                 ::CloseHandle(m_hFinishedEvent);
281                   m_hFinishedEvent = NULL;
  285                 m_hFinishedEvent = nullptr;
282 286         }
283 287
284 288         return S_OK;
285 289 }
286 290
287 291 // ============================================================================
288 292 /// CAsyncHttpFile::GetResult
289 293 /// @date 2009/04/18
290 294 ///
291 295 /// @brief     Retrieves the last call result (blocking call).
292 296 /// @return    Result of the last call.
293 297 // ============================================================================
294 298 CAsyncHttpFile::EWaitResult CAsyncHttpFile::GetResult()
295 299 {
296 300         HANDLE hHandles[] = { m_hFinishedEvent };
297 301         DWORD dwEffect = WaitForMultipleObjects(1, hHandles, FALSE, 0);
298 302         if(dwEffect == WAIT_OBJECT_0 + 0 || dwEffect == WAIT_ABANDONED_0 + 0)
299 303                 return GetErrorCode() == ERROR_SUCCESS ? CAsyncHttpFile::eFinished : CAsyncHttpFile::eError;
300 304         else
301 305                 return CAsyncHttpFile::ePending;