mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
net_node: skimplify rate limit code, and log as appropriate
This commit is contained in:
parent
01e81205e0
commit
7764cd7006
@ -1488,16 +1488,13 @@ namespace nodetool
|
|||||||
limit_up = limit * 1024;
|
limit_up = limit * 1024;
|
||||||
limit_down = limit * 1024;
|
limit_down = limit * 1024;
|
||||||
}
|
}
|
||||||
limit *= 1024;
|
if(!this->islimitup) {
|
||||||
if(this->islimitdown==false && this->islimitup==false) {
|
|
||||||
epee::net_utils::connection<epee::levin::async_protocol_handler<p2p_connection_context> >::set_rate_up_limit(limit_up);
|
epee::net_utils::connection<epee::levin::async_protocol_handler<p2p_connection_context> >::set_rate_up_limit(limit_up);
|
||||||
|
LOG_PRINT_L0("Set limit-up to " << limit_up/1024 << " kB/s");
|
||||||
|
}
|
||||||
|
if(!this->islimitdown) {
|
||||||
epee::net_utils::connection<epee::levin::async_protocol_handler<p2p_connection_context> >::set_rate_down_limit(limit_down);
|
epee::net_utils::connection<epee::levin::async_protocol_handler<p2p_connection_context> >::set_rate_down_limit(limit_down);
|
||||||
}
|
LOG_PRINT_L0("Set limit-down to " << limit_down/1024 << " kB/s");
|
||||||
else if(this->islimitdown==false && this->islimitup==true ) {
|
|
||||||
epee::net_utils::connection<epee::levin::async_protocol_handler<p2p_connection_context> >::set_rate_down_limit(limit_down);
|
|
||||||
}
|
|
||||||
else if(this->islimitdown==true && this->islimitup==false ) {
|
|
||||||
epee::net_utils::connection<epee::levin::async_protocol_handler<p2p_connection_context> >::set_rate_up_limit(limit_up);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user