mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-09 15:50:26 +03:00
added i2cp.inboundlimit and i2cp.outboundlimit
This commit is contained in:
parent
ea19d2296c
commit
1410fa5c21
@ -168,6 +168,8 @@ namespace config {
|
|||||||
("i2cp.address", value<std::string>()->default_value("127.0.0.1"), "I2CP listen address")
|
("i2cp.address", value<std::string>()->default_value("127.0.0.1"), "I2CP listen address")
|
||||||
("i2cp.port", value<uint16_t>()->default_value(7654), "I2CP listen port")
|
("i2cp.port", value<uint16_t>()->default_value(7654), "I2CP listen port")
|
||||||
("i2cp.singlethread", value<bool>()->default_value(true), "Destinations run in the I2CP server's thread")
|
("i2cp.singlethread", value<bool>()->default_value(true), "Destinations run in the I2CP server's thread")
|
||||||
|
("i2cp.inboundlimit", value<uint32_t>()->default_value(0), "Client inbound limit in KBps to return in BandwidthLimitsMessage. Router's bandwidth by default")
|
||||||
|
("i2cp.outboundlimit", value<uint32_t>()->default_value(0), "Client outbound limit in KBps to return in BandwidthLimitsMessage. Router's bandwidth by default")
|
||||||
;
|
;
|
||||||
|
|
||||||
options_description i2pcontrol("I2PControl options");
|
options_description i2pcontrol("I2PControl options");
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "ClientContext.h"
|
#include "ClientContext.h"
|
||||||
#include "Transports.h"
|
#include "Transports.h"
|
||||||
#include "Signature.h"
|
#include "Signature.h"
|
||||||
|
#include "Config.h"
|
||||||
#include "I2CP.h"
|
#include "I2CP.h"
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
||||||
@ -1003,8 +1004,12 @@ namespace client
|
|||||||
{
|
{
|
||||||
uint8_t limits[64];
|
uint8_t limits[64];
|
||||||
memset (limits, 0, 64);
|
memset (limits, 0, 64);
|
||||||
htobe32buf (limits, i2p::context.GetBandwidthLimit ()); // inbound
|
uint32_t limit; i2p::config::GetOption("i2cp.inboundlimit", limit);
|
||||||
htobe32buf (limits + 4, i2p::context.GetBandwidthLimit ()); // outbound
|
if (!limit) limit = i2p::context.GetBandwidthLimit ();
|
||||||
|
htobe32buf (limits, limit); // inbound
|
||||||
|
i2p::config::GetOption("i2cp.outboundlimit", limit);
|
||||||
|
if (!limit) limit = i2p::context.GetBandwidthLimit ();
|
||||||
|
htobe32buf (limits + 4, limit); // outbound
|
||||||
SendI2CPMessage (I2CP_BANDWIDTH_LIMITS_MESSAGE, limits, 64);
|
SendI2CPMessage (I2CP_BANDWIDTH_LIMITS_MESSAGE, limits, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user