This site is for P2P development and test software ONLY!

Push clients to upload

In UploadQueue.cpp search this part

InsertInUploadingList(cur_client);
}

theApp.uploadBandwidthThrottler->Pause(false);
}
}
and add

//Start Push
void CUploadQueue::AddUpload(CUpDownClient* client){
RemoveFromWaitingQueue(client, true);
theApp.emuledlg->transferwnd->ShowQueueCount(waitinglist.GetCount());
AddUpNextClient(_T("Push2Upload"),client);
}
// End Push

In UploadQueue.h search

bool IsDownloading(CUpDownClient* client) const {return (uploadinglist.Find(client) != 0);}
and add

void AddUpload(CUpDownClient* client); // Push

In QueueListCtrl.cpp search

ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && !client->IsFriend()) ? MF_ENABLED : MF_GRAYED), MP_ADDFRIEND, GetResString(IDS_ADDFRIEND), _T("ADDFRIEND"));
and add

//Start Push
ClientMenu.AppendMenu(MF_SEPARATOR);
ClientMenu.AppendMenu(MF_STRING | (client ? MF_ENABLED : MF_GRAYED), MP_ADDUPLOAD, _T("Push2Upload"), _T("WPUSH"));
//End Push

still QueueListCtrl.cpp search

case MP_BOOT:
if (client && client->GetKadPort())
Kademlia::CKademlia::bootstrap(ntohl(client->GetIP()), client->GetKadPort());
break;
and add

//Start Push
case MP_ADDUPLOAD:{
theApp.uploadqueue->AddUpload(client);
break;
}
//End Push

at the end of MenuCmds.h add

#define MP_ADDUPLOAD 999999 // Push //Note: choose instead of 999999 the next free value

0 comments:

发表评论