|
@@ -114,6 +114,18 @@ while True:
|
|
|
temp[x]['clients'] = []
|
|
|
temp[x]['neighbours'] = []
|
|
|
storage.data = dict_merge(temp, newdata)
|
|
|
+ # sanitize each item's data
|
|
|
+ for itemid in storage.data:
|
|
|
+ if itemid.startswith('__'): continue
|
|
|
+ item = storage.data[itemid]
|
|
|
+
|
|
|
+ # remove node's MACs from clients list
|
|
|
+ clients = [ x for x in item['clients'] ] if 'clients' in item else []
|
|
|
+ if 'mac' in item and item['mac'] in clients: clients.remove(item['mac'])
|
|
|
+ if 'macs' in item:
|
|
|
+ for x in item['macs']:
|
|
|
+ if x in clients: clients.remove(x)
|
|
|
+ storage.data[itemid]['clientcount'] = len(clients)
|
|
|
logger.debug('I have data for ' + str(len(storage.data)) + ' nodes.')
|
|
|
|
|
|
storage.save()
|