void vmsBtSessionImpl::RestoreDownloadHandle (vmsBtDownloadImpl* dld) { vmsAUTOLOCKSECTION (m_csRestoreTorrentHandle); if (dld == NULL || dld->GetHandle().is_valid ()) return; try { vmsBtFileImplPtr dldImpl = dld->GetTorrentImpl(); if (dldImpl == NULL || dldImpl->m_torrent == NULL) { return; } libtorrent::torrent_handle& handleLink = dld->GetHandle(); handleLink = m_session.add_torrent(*dldImpl->m_torrent, dld->GetOutputPath()); dld->GetHandle().pause(); } catch (...) { return; } vmsAUTOLOCKSECTION_UNLOCK (m_csRestoreTorrentHandle); if (m_pfnEvHandler) { vmsBtSessionEvent ev; ev.enType = BTSET_BTDLD_WAS_RESET; ev.pDownload = dld; ev.pszMsg = NULL; m_pfnEvHandler (this, &ev, m_pEvData); } }
DWORD vmsTpDownloadMgr::RaiseEvent(fsDownloaderEvent ev, DWORD dw) { if (m_pfnEvHandler == NULL) return 0; return m_pfnEvHandler (this, ev, dw, m_lpEvParam); }