diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-09-26 12:23:43 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-09-26 12:23:43 -0700 |
| commit | 2d41055bdce886722d1b6a355559862016ac964c (patch) | |
| tree | b7af7882c20515f0e8695c2adc8e2500f1d19e5a /node/Network.hpp | |
| parent | 027060dad15df2273dcb25616bea5446be335f55 (diff) | |
| download | infinitytier-2d41055bdce886722d1b6a355559862016ac964c.tar.gz infinitytier-2d41055bdce886722d1b6a355559862016ac964c.zip | |
Some Network code cleanup.
Diffstat (limited to 'node/Network.hpp')
| -rw-r--r-- | node/Network.hpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/node/Network.hpp b/node/Network.hpp index d6e86958..8d4092bb 100644 --- a/node/Network.hpp +++ b/node/Network.hpp @@ -249,7 +249,7 @@ public: Status status() const; /** - * Update and check multicast rate balance for a group + * Update and check multicast rate balance for a multicast group * * @param mg Multicast group * @param bytes Size of packet @@ -302,12 +302,6 @@ public: } /** - * Thread main method; do not call elsewhere - */ - void threadMain() - throw(); - - /** * Inject a frame into tap (if it's created and network is enabled) * * @param from Origin MAC @@ -318,6 +312,7 @@ public: */ inline void tapPut(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len) { + Mutex::Lock _l(_lock); if (!_enabled) return; EthernetTap *t = _tap; @@ -330,6 +325,7 @@ public: */ inline std::string tapDeviceName() const { + Mutex::Lock _l(_lock); EthernetTap *t = _tap; if (t) return t->deviceName(); @@ -339,17 +335,14 @@ public: /** * @return Ethernet MAC address for this network's local interface */ - inline const MAC &mac() const - throw() - { - return _mac; - } + inline const MAC &mac() const throw() { return _mac; } /** * @return Set of IPs currently assigned to interface */ inline std::set<InetAddress> ips() const { + Mutex::Lock _l(_lock); EthernetTap *t = _tap; if (t) return t->ips(); @@ -371,8 +364,10 @@ public: } /** + * Find the node on this network that has this MAC behind it (if any) + * * @param mac MAC address - * @return ZeroTier address of bridge to this MAC or null address if not found (also check result for self, since this can happen) + * @return ZeroTier address of bridge to this MAC */ inline Address findBridgeTo(const MAC &mac) const { @@ -422,12 +417,18 @@ public: */ void destroy(); + /** + * Thread main method; do not call elsewhere + */ + void threadMain() + throw(); + private: static void _CBhandleTapData(void *arg,const MAC &from,const MAC &to,unsigned int etherType,const Buffer<4096> &data); void _pushMembershipCertificate(const Address &peer,bool force,uint64_t now); void _restoreState(); - void _dumpMulticastCerts(); + void _dumpMembershipCerts(); inline void _mkNetworkFriendlyName(char *buf,unsigned int len) { |
