diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-07-07 10:49:50 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-07-07 10:49:50 -0700 |
| commit | 3f567a07ca0cda5c3370105d88cb939ad62b4b7d (patch) | |
| tree | d84ea22fc19d74f9a7bb7441ff399e2a702caee7 /node/Switch.cpp | |
| parent | 41fc08b3308be6ac57d737b225a58d41854bd695 (diff) | |
| download | infinitytier-3f567a07ca0cda5c3370105d88cb939ad62b4b7d.tar.gz infinitytier-3f567a07ca0cda5c3370105d88cb939ad62b4b7d.zip | |
Save a little bit of RAM by getting rid of overkill CMWC4096 non-crypto PRNG and replacing it with a simple non-crypto PRNG that just uses Salsa20.
Diffstat (limited to 'node/Switch.cpp')
| -rw-r--r-- | node/Switch.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/node/Switch.cpp b/node/Switch.cpp index 62fa02cd..4fd5d769 100644 --- a/node/Switch.cpp +++ b/node/Switch.cpp @@ -42,7 +42,6 @@ #include "InetAddress.hpp" #include "Topology.hpp" #include "Peer.hpp" -#include "CMWC4096.hpp" #include "AntiRecursion.hpp" #include "Packet.hpp" @@ -236,7 +235,7 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c while (numBridges < ZT_MAX_BRIDGE_SPAM) { if (ab == nconf->activeBridges().end()) ab = nconf->activeBridges().begin(); - if (((unsigned long)RR->prng->next32() % (unsigned long)nconf->activeBridges().size()) == 0) { + if (((unsigned long)RR->node->prng() % (unsigned long)nconf->activeBridges().size()) == 0) { bridges[numBridges++] = *ab; ++ab; } else ++ab; @@ -327,7 +326,7 @@ bool Switch::unite(const Address &p1,const Address &p2,bool force) * the order we make each attempted NAT-t favor one or the other going * first, meaning if it doesn't succeed the first time it might the second * and so forth. */ - unsigned int alt = RR->prng->next32() & 1; + unsigned int alt = (unsigned int)RR->node->prng() & 1; unsigned int completed = alt + 2; while (alt != completed) { if ((alt & 1) == 0) { |
