abstract_tcp_server2: fix busy calling of idle IO service
This would make monerod use 100% CPU when running with torsocks without Tor running
This commit is contained in:
parent
25e7a7d96f
commit
3381b6517e
|
@ -383,7 +383,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
||||||
//ask it inside(!) critical region if we still able to go in event wait...
|
//ask it inside(!) critical region if we still able to go in event wait...
|
||||||
size_t cnt = socket_.get_io_service().poll_one();
|
size_t cnt = socket_.get_io_service().poll_one();
|
||||||
if(!cnt)
|
if(!cnt)
|
||||||
misc_utils::sleep_no_w(0);
|
misc_utils::sleep_no_w(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -836,7 +836,9 @@ POP_WARNINGS
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
io_service_.run();
|
size_t cnt = io_service_.run();
|
||||||
|
if (cnt == 0)
|
||||||
|
misc_utils::sleep_no_w(1);
|
||||||
}
|
}
|
||||||
catch(const std::exception& ex)
|
catch(const std::exception& ex)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue