mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
* update --bandwidth option handling
This commit is contained in:
parent
aef6b7712c
commit
350dea6228
2 changed files with 12 additions and 25 deletions
35
Daemon.cpp
35
Daemon.cpp
|
@ -142,34 +142,21 @@ namespace i2p
|
|||
i2p::context.SetAcceptsTunnels (!transit);
|
||||
|
||||
bool isFloodfill; i2p::config::GetOption("floodfill", isFloodfill);
|
||||
char bandwidth; i2p::config::GetOption("bandwidth", bandwidth);
|
||||
|
||||
if (isFloodfill)
|
||||
{
|
||||
if (isFloodfill) {
|
||||
LogPrint(eLogInfo, "Daemon: router will be floodfill");
|
||||
i2p::context.SetFloodfill (true);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
i2p::context.SetFloodfill (false);
|
||||
if (bandwidth != '-')
|
||||
{
|
||||
LogPrint(eLogInfo, "Daemon: bandwidth set to ", bandwidth);
|
||||
if (bandwidth > 'O')
|
||||
i2p::context.SetExtraBandwidth ();
|
||||
else if (bandwidth > 'L')
|
||||
i2p::context.SetHighBandwidth ();
|
||||
else
|
||||
i2p::context.SetLowBandwidth ();
|
||||
}
|
||||
else if (isFloodfill)
|
||||
{
|
||||
LogPrint(eLogInfo, "Daemon: floodfill bandwidth set to 'extra'");
|
||||
i2p::context.SetExtraBandwidth ();
|
||||
}
|
||||
else
|
||||
{
|
||||
LogPrint(eLogInfo, "Daemon: bandwidth set to 'low'");
|
||||
i2p::context.SetLowBandwidth ();
|
||||
|
||||
/* this section also honors 'floodfill' flag, if set above */
|
||||
std::string bandwidth; i2p::config::GetOption("bandwidth", bandwidth);
|
||||
if (bandwidth[0] > 'K' && bandwidth[0] < 'Z') {
|
||||
i2p::context.SetBandwidth (bandwidth[0]);
|
||||
LogPrint(eLogInfo, "Daemon: bandwidth set to ", i2p::context.GetBandwidthLimit (), "KBps");
|
||||
} else if (bandwidth[0] >= '0' && bandwidth[0] <= '9') {
|
||||
i2p::context.SetBandwidth (std::atoi(bandwidth.c_str()));
|
||||
LogPrint(eLogInfo, "Daemon: bandwidth set to ", i2p::context.GetBandwidthLimit (), " KBps");
|
||||
}
|
||||
|
||||
std::string family; i2p::config::GetOption("family", family);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue