summaryrefslogtreecommitdiff
path: root/controller/EmbeddedNetworkController.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-03-06 16:21:49 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-03-06 16:21:49 -0800
commit7ea7e1898a88ee60a346582fd6185e4f727759bf (patch)
treeac292dc348c3193e5e81fd2061e9bb6da9dcebfe /controller/EmbeddedNetworkController.hpp
parent5e6a4e5f5e0022dccbc2f6cf8a8b38c038720866 (diff)
downloadinfinitytier-7ea7e1898a88ee60a346582fd6185e4f727759bf.tar.gz
infinitytier-7ea7e1898a88ee60a346582fd6185e4f727759bf.zip
Fix a bug that could cause duplicate IP address assignment on networks if many new members join the controller at once.
Diffstat (limited to 'controller/EmbeddedNetworkController.hpp')
-rw-r--r--controller/EmbeddedNetworkController.hpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/controller/EmbeddedNetworkController.hpp b/controller/EmbeddedNetworkController.hpp
index 7163c004..bca0956e 100644
--- a/controller/EmbeddedNetworkController.hpp
+++ b/controller/EmbeddedNetworkController.hpp
@@ -121,7 +121,6 @@ private:
Mutex _threads_m;
// Gathers a bunch of statistics about members of a network, IP assignments, etc. that we need in various places
- // This does lock _networkMemberCache_m
struct _NetworkMemberInfo
{
_NetworkMemberInfo() : authorizedMemberCount(0),activeMemberCount(0),totalMemberCount(0),mostRecentDeauthTime(0) {}
@@ -136,6 +135,11 @@ private:
std::map<uint64_t,_NetworkMemberInfo> _nmiCache;
Mutex _nmiCache_m;
void _getNetworkMemberInfo(uint64_t now,uint64_t nwid,_NetworkMemberInfo &nmi);
+ inline void _clearNetworkMemberInfoCache(const uint64_t nwid)
+ {
+ Mutex::Lock _l(_nmiCache_m);
+ _nmiCache.erase(nwid);
+ }
void _pushMemberUpdate(uint64_t now,uint64_t nwid,const nlohmann::json &member);