beaconSource &getSource(const address &baddr, const char *name, uint64_t now, uint64_t recvdts, bool rx_local) { Sources::iterator i = sources.find(baddr); if (i != sources.end()) { i->second.lastevent = now; if (rx_local) i->second.lastlocalevent = now; return i->second; } beaconSource &src = sources[baddr]; if (verbose) { char tmp[64]; if (name) info("Adding source %s [%s]", baddr.to_string(tmp, sizeof(tmp)), name); else info("Adding source %s", baddr.to_string(tmp, sizeof(tmp))); } if (name) src.setName(name); src.creation = now; src.lastevent = now; if (rx_local) src.lastlocalevent = now; if (IsSSMEnabled()) CountSSMJoin(ssmProbeAddr, baddr); return src; }
void removeSource(const address &baddr, bool timeout) { Sources::iterator i = sources.find(baddr); if (i != sources.end()) { if (verbose) { char tmp[64]; if (i->second.identified) { info("Removing source %s [%s]%s", baddr.to_string(tmp, sizeof(tmp)), i->second.name.c_str(), (timeout ? " by Timeout" : "")); } else { info("Removing source %s%s", baddr.to_string(tmp, sizeof(tmp)), (timeout ? " by Timeout" : "")); } } if (IsSSMEnabled()) CountSSMLeave(ssmProbeAddr, baddr); sources.erase(i); } }