This site is for P2P development and test software ONLY!

Slots Control

Files to modify:
UploadQueue.cpp
Preferences.cpp
Preferences.h
UploadListCtrl.cpp
MenuCmds.h
PPgxx.cpp
PPgxx.h
String Table

UploadQueue.cpp



bool CUploadQueue::AcceptNewClient(uint32 curUploadSlots){
   // check if we can allow a new client to start downloading from us
//slots control 
if(uploadinglist.GetCount() >= thePrefs.GetNbUploadSlots()&&thePrefs.GetControlSlot() == true)
      return false;
//slots control



Preferences.cpp
[code]
CPreferences thePrefs;
//slots control
bool CPreferences::ControlSlot;
uint16 CPreferences::NbUploadSlots;
//slots control
......
ini.WriteBool(_T("SparsePartFiles"),m_bSparsePartFiles);
ini.WriteString(_T("YourHostname"),m_strYourHostname);
//Slot Control
ini.WriteBool(_T("Activer la gestion des slot en

1 comments:

Recon 说...

in uploadqueue.cpp
search:
bool CUploadQueue::AcceptNewClient(uint32 curUploadSlots){

and add after:
if (curUploadSlots > 0)
return false;

and make:
bool CUploadQueue::ForceNewClient(bool allowEmptyWaitingQueue) {
if(!allowEmptyWaitingQueue && waitinglist.GetSize() <= 0)
return false;

if (::GetTickCount() - m_nLastStartUpload < 1000 && datarate < 102400 )
return false;

uint32 curUploadSlots = (uint32)uploadinglist.GetCount();
// remove it
//if (curUploadSlots < MIN_UP_CLIENTS_ALLOWED)
// return true;
//to force only one slot, put
if (curUploadSlots >0)
return false;

test uploadqueue.cpp

search:
bool CUploadQueue::AcceptNewClient(uint32 curUploadSlots){
and add after:
if (curUploadSlots > 0)
return false;

and make:
bool CUploadQueue::ForceNewClient(bool allowEmptyWaitingQueue) {
if(!allowEmptyWaitingQueue && waitinglist.GetSize() <= 0)
return false;

if (::GetTickCount() - m_nLastStartUpload < 1000 && datarate < 102400 )
return false;

uint32 curUploadSlots = (uint32)uploadinglist.GetCount();
// remove it
//if (curUploadSlots < MIN_UP_CLIENTS_ALLOWED)
// return true;
//to force only one slot, put
if (curUploadSlots >0)
return false;

发表评论