aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-11-06 14:49:32 +0200
committerRiccardo Spagni <ric@spagni.net>2018-11-06 14:49:32 +0200
commitdd973179adb88fc28def1d6293970689baac4dfb (patch)
treef75b86dca15f603f513de6194b3f47bb6115aa8c
parentMerge pull request #4760 (diff)
parentabstract_tcp_server2: fix busy calling of idle IO service (diff)
downloadmonero-dd973179adb88fc28def1d6293970689baac4dfb.tar.xz
Merge pull request #3970
3381b651 abstract_tcp_server2: fix busy calling of idle IO service (moneromooo-monero)
-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 5dbb7a478..9b03941ee 100644
--- a/contrib/epee/include/net/abstract_tcp_server2.inl
+++ b/contrib/epee/include/net/abstract_tcp_server2.inl
@@ -393,7 +393,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;
@@ -889,7 +889,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)
{