root work

This commit is contained in:
Adam Ierymenko 2019-08-28 11:59:13 -07:00
parent 4e4b27b6ab
commit 5e3c633f74
No known key found for this signature in database
GPG Key ID: C8877CF2D7A5D7F3

View File

@ -60,6 +60,7 @@
#include <iostream>
#include <unordered_map>
#include <vector>
#include <atomic>
using namespace ZeroTier;
@ -72,6 +73,7 @@ struct PeerInfo
struct AddressHasher { ZT_ALWAYS_INLINE std::size_t operator()(const Address &a) const { return (std::size_t)a.toInt(); } };
struct InetAddressHasher { ZT_ALWAYS_INLINE std::size_t operator()(const InetAddress &ip) const { return (std::size_t)ip.hashCode(); } };
static std::atomic_bool run;
static std::unordered_map< Address,std::map< Identity,PeerInfo >,AddressHasher > peersByVirtAddr;
static std::unordered_map< InetAddress,std::map< Identity,PeerInfo >,InetAddressHasher > peersByPhysAddr;
static Mutex peersByVirtAddr_l;
@ -133,6 +135,8 @@ int main(int argc,char **argv)
unsigned int ncores = std::thread::hardware_concurrency();
if (ncores == 0) ncores = 1;
run = true;
std::vector<int> sockets;
std::vector<std::thread> threads;
for(unsigned int tn=0;tn<ncores;++tn) {
@ -198,5 +202,9 @@ int main(int argc,char **argv)
}));
}
while (run) {
sleep(1);
}
return 0;
}