MCPcopy Create free account
hub / github.com/amule-project/amule / PauseFile

Method PauseFile

src/PartFile.cpp:2626–2674  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2624
2625
2626void CPartFile::PauseFile(bool bInsufficient)
2627{
2628 SetActive(false);
2629
2630 if ( status == PS_COMPLETE || status == PS_COMPLETING ) {
2631 return;
2632 }
2633
2634 if (GetKadFileSearchID()) {
2635 Kademlia::CSearchManager::StopSearch(GetKadFileSearchID(), true);
2636 // If we were in the middle of searching, reset timer so they can resume searching.
2637 m_LastSearchTimeKad = 0;
2638 }
2639
2640 m_iLastPausePurge = time(NULL);
2641
2642 theApp->downloadqueue->RemoveLocalServerRequest(this);
2643
2644 CPacket packet( OP_CANCELTRANSFER, 0, OP_EDONKEYPROT );
2645 for( SourceSet::iterator it = m_SrcList.begin(); it != m_SrcList.end(); ) {
2646 CUpDownClient* cur_src = it++->GetClient();
2647 if (cur_src->GetDownloadState() == DS_DOWNLOADING) {
2648 if (!cur_src->GetSentCancelTransfer()) {
2649 theStats::AddUpOverheadOther( packet.GetPacketSize() );
2650 AddDebugLogLineN( logLocalClient, "Local Client: OP_CANCELTRANSFER to " + cur_src->GetFullIP() );
2651 cur_src->SendPacket( &packet, false, true );
2652 cur_src->SetSentCancelTransfer( true );
2653 }
2654 cur_src->SetDownloadState(DS_ONQUEUE);
2655 // Allow immediate reconnect on resume
2656 cur_src->ResetLastAskedTime();
2657 }
2658 }
2659
2660
2661 m_insufficient = bInsufficient;
2662 if (!m_paused) {
2663 MarkMetDirty();
2664 // EC exports IsStopped() / GetStatus(); see StopFile comment.
2665 MarkECChanged();
2666 }
2667 m_paused = true;
2668
2669
2670 kBpsDown = 0.0;
2671 transferingsrc = 0;
2672
2673 SetStatus(status);
2674}
2675
2676
2677void CPartFile::ResumeFile()

Callers 5

AddDownloadMethod · 0.80
SetCatStatusMethod · 0.80
CheckDiskspaceMethod · 0.80
PartFile_PauseFunction · 0.80

Calls 12

GetSentCancelTransferMethod · 0.80
GetPacketSizeMethod · 0.80
SetSentCancelTransferMethod · 0.80
SetDownloadStateMethod · 0.80
ResetLastAskedTimeMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
GetClientMethod · 0.45
GetDownloadStateMethod · 0.45
GetFullIPMethod · 0.45
SendPacketMethod · 0.45

Tested by

no test coverage detected