diff --git a/src/NetworkInterface.cpp b/src/NetworkInterface.cpp index f44b47edd0..58304fce4a 100644 --- a/src/NetworkInterface.cpp +++ b/src/NetworkInterface.cpp @@ -8791,15 +8791,19 @@ void NetworkInterface::luaServiceMap(lua_State* vm, #if defined(NTOPNG_PRO) && !defined(HAVE_NEDGE) void NetworkInterface::updateFlowPeriodicity(Flow *f) { - if(pMap && f) pMap->updateElement(f, f->get_first_seen()); + if(isViewed()) + viewedBy()->updateFlowPeriodicity(f); + else if(pMap) + pMap->updateElement(f, f->get_first_seen()); } -#endif /* *************************************** */ -#if defined(NTOPNG_PRO) && !defined(HAVE_NEDGE) void NetworkInterface::updateServiceMap(Flow *f) { - if(sMap && f) sMap->update(f, f->get_first_seen()); + if(isViewed()) + viewedBy()->updateServiceMap(f); + else if(sMap) + sMap->update(f, f->get_first_seen()); } #endif diff --git a/src/ViewInterface.cpp b/src/ViewInterface.cpp index 1ff0506b84..39b5f0ba03 100644 --- a/src/ViewInterface.cpp +++ b/src/ViewInterface.cpp @@ -483,15 +483,6 @@ void ViewInterface::viewed_flows_walker(Flow *f, const struct timeval *tv) { findFlowHosts(f->get_vlan_id(), f->get_observation_point_id(), NULL /* no src mac yet */, (IpAddress*)cli_ip, &cli_host, NULL /* no dst mac yet */, (IpAddress*)srv_ip, &srv_host); - -#if defined(NTOPNG_PRO) && !defined(HAVE_NEDGE) - /* - For view interfaces, service and periodicity maps need to be updated there, - only the first time a flow is seen. - */ - updateFlowPeriodicity(f); - updateServiceMap(f); -#endif } else { /* The unsafe pointers can be used here as ViewInterface::viewed_flows_walker is * called synchronously with the ViewInterface purgeIdle. This also saves some