Esempio n. 1
0
void aggr_source_discovery::dump_cache(base_stream &out, const cache &c) const {
	time_t now = time(0);

	for (cache::const_iterator i = c.begin(); i != c.end(); ++i) {
		out.xprintf("(%{Addr}, %{Addr}) for %{duration}\n",
			    i->first.second, i->first.first,
			    time_duration((now - i->second) * 1000));
	}
}
Esempio n. 2
0
void aggr_source_discovery::run_gc(cache &c) {
	time_t now = time(0);

	cache::iterator i = c.begin();

	while (i != c.end()) {
		cache::iterator j = i;
		++i;

		if ((now - j->second) > m_keepalive) {
			if (g_mrd->should_log(INTERNAL_FLOW)) {
				g_mrd->log().xprintf("AggrSourceDiscovery "
					"cleaned source (%{Addr}, %{Addr}).\n",
					j->first.second, j->first.first);
			}

			c.erase(j);
		}
	}
}