aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include/net
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-06-09 12:37:15 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-06-09 12:38:29 +0100
commit3381b6517e9f8138170b71038b6478afd9555d05 (patch)
tree56c2a331452bc636ebb61ca3039305728aa04995 /contrib/epee/include/net
parentMerge pull request #3340 (diff)
downloadmonero-3381b6517e9f8138170b71038b6478afd9555d05.tar.xz
abstract_tcp_server2: fix busy calling of idle IO service
This would make monerod use 100% CPU when running with torsocks without Tor running
Diffstat (limited to 'contrib/epee/include/net')
-rw-r--r--contrib/epee/include/net/abstract_tcp_server2.inl6
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl
index 91a94c21e..bc54acae4 100644
--- a/contrib/epee/include/net/abstract_tcp_server2.inl
+++ b/contrib/epee/include/net/abstract_tcp_server2.inl
@@ -383,7 +383,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
//ask it inside(!) critical region if we still able to go in event wait...
size_t cnt = socket_.get_io_service().poll_one();
if(!cnt)
- misc_utils::sleep_no_w(0);
+ misc_utils::sleep_no_w(1);
}
return true;
@@ -836,7 +836,9 @@ POP_WARNINGS
{
try
{
- io_service_.run();
+ size_t cnt = io_service_.run();
+ if (cnt == 0)
+ misc_utils::sleep_no_w(1);
}
catch(const std::exception& ex)
{