Skip to content

Commit

Permalink
[fix] mac os x includes std::random...
Browse files Browse the repository at this point in the history
  • Loading branch information
rfree2monero committed Apr 1, 2015
1 parent 162c993 commit 44f4234
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contrib/epee/include/net/levin_protocol_handler_async.h
Expand Up @@ -34,6 +34,9 @@
#include "levin_base.h"
#include "misc_language.h"

#include <random>
#include <chrono>


namespace epee
{
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 44f4234

Please sign in to comment.