aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include/net/levin_protocol_handler_async.h
diff options
context:
space:
mode:
authorrfree2monero <rfreemonero@op.pl>2015-04-01 20:25:53 +0200
committerrfree2monero <rfreemonero@op.pl>2015-04-01 20:25:53 +0200
commit44f423477a6ce0971ced31afee38e259b2b571d6 (patch)
tree5e95fa3d6637a36f2c16f46d19c834c3e12d38d3 /contrib/epee/include/net/levin_protocol_handler_async.h
parentNetwork 1.6: network limits, logging, +doxy (diff)
downloadmonero-44f423477a6ce0971ced31afee38e259b2b571d6.tar.xz
[fix] mac os x includes std::random...
Diffstat (limited to 'contrib/epee/include/net/levin_protocol_handler_async.h')
-rw-r--r--contrib/epee/include/net/levin_protocol_handler_async.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/contrib/epee/include/net/levin_protocol_handler_async.h b/contrib/epee/include/net/levin_protocol_handler_async.h
index dacbfd4d9..a7fbffb4b 100644
--- a/contrib/epee/include/net/levin_protocol_handler_async.h
+++ b/contrib/epee/include/net/levin_protocol_handler_async.h
@@ -34,6 +34,9 @@
#include "levin_base.h"
#include "misc_language.h"
+#include <random>
+#include <chrono>
+
namespace epee
{
@@ -684,6 +687,7 @@ void async_protocol_handler_config<t_connection_context>::del_out_connections(si
return;
// close random out connections
+ // TODO or better just keep removing random elements (performance)
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
shuffle(out_connections.begin(), out_connections.end(), std::default_random_engine(seed));
while (count > 0 && out_connections.size() > 0)