aboutsummaryrefslogtreecommitdiff
path: root/src/p2p
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-08-11 20:32:19 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-08-11 20:32:48 +0100
commit7764cd70061638bdc80cc2bc601fbce63d58b6c3 (patch)
treef5655b70d3c0f213507a46148f1a78934cc13636 /src/p2p
parentMerge pull request #365 (diff)
downloadmonero-7764cd70061638bdc80cc2bc601fbce63d58b6c3.tar.xz
net_node: skimplify rate limit code, and log as appropriate
Diffstat (limited to 'src/p2p')
-rw-r--r--src/p2p/net_node.inl13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index bce3ab5af..7360adc3c 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -1488,16 +1488,13 @@ namespace nodetool
limit_up = limit * 1024;
limit_down = limit * 1024;
}
- limit *= 1024;
- if(this->islimitdown==false && this->islimitup==false) {
+ if(!this->islimitup) {
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);
- }
- 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);
+ LOG_PRINT_L0("Set limit-down to " << limit_down/1024 << " kB/s");
}
return true;