diff --git a/src/HTTPserver.cpp b/src/HTTPserver.cpp index 82b327b762..8584faa200 100644 --- a/src/HTTPserver.cpp +++ b/src/HTTPserver.cpp @@ -39,7 +39,7 @@ static HTTPserver *httpserver; * Send error message back to a client. */ int send_error(struct mg_connection *conn, int status, const char *reason, const char *fmt, ...) { - va_list ap; + va_list ap; conn->status_code = status; diff --git a/src/NetworkInterface.cpp b/src/NetworkInterface.cpp index 569776d7b5..b1b7a7d069 100644 --- a/src/NetworkInterface.cpp +++ b/src/NetworkInterface.cpp @@ -625,6 +625,7 @@ void NetworkInterface::deleteDataStructures() { if(ases_hash) { delete(ases_hash); ases_hash = NULL; } if(vlans_hash) { delete(vlans_hash); vlans_hash = NULL; } if(macs_hash) { delete(macs_hash); macs_hash = NULL; } + #ifdef NTOPNG_PRO if(aggregated_flows_hash) { aggregated_flows_hash->cleanup(); @@ -633,11 +634,6 @@ void NetworkInterface::deleteDataStructures() { } #endif - if(ndpi_struct) { - ndpi_exit_detection_module(ndpi_struct); - ndpi_struct = NULL; - } - if(ifname) { //ntop->getTrace()->traceEvent(TRACE_NORMAL, "Interface %s shutdown", ifname); free(ifname); @@ -655,9 +651,9 @@ NetworkInterface::~NetworkInterface() { cleanup(); } - if(db) delete db; - if(host_pools) delete host_pools; /* note: this requires ndpi_struct */ deleteDataStructures(); + + if(host_pools) delete host_pools; /* note: this requires ndpi_struct */ if(ifDescription) free(ifDescription); if(discovery) delete discovery; if(mdns) delete mdns; @@ -681,10 +677,15 @@ NetworkInterface::~NetworkInterface() { flowHashing = NULL; } - ndpi_exit_detection_module(ndpi_struct); + if(ndpi_struct) { + ndpi_exit_detection_module(ndpi_struct); + ndpi_struct = NULL; + } + delete frequentProtocols; delete frequentMacs; - + if(db) delete db; + #ifdef NTOPNG_PRO if(policer) delete(policer); #ifndef HAVE_NEDGE @@ -773,8 +774,6 @@ int NetworkInterface::dumpDBFlow(time_t when, Flow *f) { #ifdef NTOPNG_PRO int NetworkInterface::dumpAggregatedFlow(AggregatedFlow *f) { - // ntop->getTrace()->traceEvent(TRACE_NORMAL, "*** DUMP ***"); - if(db && f && (f->get_packets() > 0) @@ -786,8 +785,6 @@ int NetworkInterface::dumpAggregatedFlow(AggregatedFlow *f) { "Going to dump AggregatedFlow to database [%s]", f->print(buf, sizeof(buf))); #endif - - //return(dynamic_cast(db)->dumpAggregatedFlow(f)); return(db->dumpAggregatedFlow(f)); } diff --git a/src/Ntop.cpp b/src/Ntop.cpp index 6279b4b769..b93cb34ad2 100644 --- a/src/Ntop.cpp +++ b/src/Ntop.cpp @@ -152,25 +152,27 @@ Ntop::Ntop(char *appName) { #endif #if defined(NTOPNG_PRO) && defined(HAVE_NDB) - for(int i=0; igetTrace()->traceEvent(TRACE_WARNING, "Internal error"); + if(!ntop->getPro()->is_ndb_in_use()) { + for(int i=0; igetTrace()->traceEvent(TRACE_WARNING, "Internal error"); + } + + snprintf(path, sizeof(path), "%s/nseries/%s", ntop->get_working_dir(), base); + + if(!Utils::mkdir_tree(path)) + ntop->getTrace()->traceEvent(TRACE_WARNING, + "Unable to create directory %s: nSeries will be disabled", path); + else + nseries[i] = new Nseries(path, NSERIES_DATA_RETENTION, true /* readWrite */); } - - snprintf(path, sizeof(path), "%s/nseries/%s", ntop->get_working_dir(), base); - - if(!Utils::mkdir_tree(path)) - ntop->getTrace()->traceEvent(TRACE_WARNING, - "Unable to create directory %s: nSeries will be disabled", path); - else - nseries[i] = new Nseries(path, NSERIES_DATA_RETENTION, true /* readWrite */); } #endif } @@ -254,8 +256,10 @@ Ntop::~Ntop() { #endif #ifdef HAVE_NDB - for(int i=0; igetPro()->is_ndb_in_use()) { + for(int i=0; i