mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-19 22:40:36 -04:00
Added external interface to control Relay Parameters.
* Modified UdpRelay handles the counting... now each Relay Class has a bandwidth limit, and you can drop down to a lower class - if your one is full. This ensures that the desired bandwidth is kept, and allows more friends to use the relays. * Added Interface in p3bitdht. TODO: Test this stuff! git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4728 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
4d2175636e
commit
203fd6bffc
5 changed files with 159 additions and 53 deletions
|
@ -164,6 +164,13 @@ virtual int getRelayProxies(std::list<RsDhtRelayProxy> &relayProxies);
|
|||
|
||||
virtual std::string getUdpAddressString();
|
||||
|
||||
// Interface for controlling Relays & DHT Relay Mode
|
||||
virtual uint32_t getRelayMode();
|
||||
virtual int setRelayMode(uint32_t mode);
|
||||
|
||||
virtual int getRelayAllowance(int classIdx, uint32_t &count, uint32_t &bandwidth);
|
||||
virtual int setRelayAllowance(int classIdx, uint32_t count, uint32_t bandwidth);
|
||||
|
||||
/***********************************************************************************************
|
||||
********** External RsDHT Interface (defined in libretroshare/src/retroshare/rsdht.h) *********
|
||||
************************************************************************************************/
|
||||
|
|
|
@ -197,6 +197,53 @@ std::string p3BitDht::getUdpAddressString()
|
|||
/***********************************************************************************************
|
||||
********** External RsDHT Interface (defined in libretroshare/src/retroshare/rsdht.h) *********
|
||||
************************************************************************************************/
|
||||
/***********************************************************************************************
|
||||
********** External RsDHT Interface for Dht-Relay Control *************************************
|
||||
************************************************************************************************/
|
||||
|
||||
uint32_t p3BitDht::getRelayMode()
|
||||
{
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int p3BitDht::setRelayMode(uint32_t mode)
|
||||
{
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int p3BitDht::getRelayAllowance(int classIdx, uint32_t &count, uint32_t &bandwidth)
|
||||
{
|
||||
std::cerr << "p3BitDht::getRelayAllowance(" << classIdx << "): ";
|
||||
if ((classIdx >= 0) && (classIdx < RSDHT_RELAY_NUM_CLASS))
|
||||
{
|
||||
count = mRelay->getRelayClassMax(classIdx);
|
||||
bandwidth = mRelay->getRelayClassBandwidth(classIdx);
|
||||
|
||||
std::cerr << " count: " << count << " bandwidth: " << bandwidth;
|
||||
std::cerr << std::endl;
|
||||
return 1;
|
||||
}
|
||||
std::cerr << " Invalid classIdx";
|
||||
std::cerr << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int p3BitDht::setRelayAllowance(int classIdx, uint32_t count, uint32_t bandwidth)
|
||||
{
|
||||
std::cerr << "p3BitDht::getRelayAllowance(" << classIdx << ", ";
|
||||
std::cerr << ", " << count << ", " << bandwidth << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
return mRelay->setRelayClassMax(classIdx, count, bandwidth);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
********** External RsDHT Interface for Dht-Relay Control *************************************
|
||||
************************************************************************************************/
|
||||
|
||||
|
||||
void convertBdPeerToRsDhtPeer(RsDhtPeer &peer, const bdPeer &int_peer)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue