return;
}
+/** \brief Cleanup the host engine
+ *
+ * Cleanup the host engine from tag and threshold.
+ *
+ */
+void HostCleanup(void)
+{
+ Host *h;
+ uint32_t u;
+
+ if (host_hash != NULL) {
+ for (u = 0; u < host_config.hash_size; u++) {
+ h = host_hash[u].head;
+ HostHashRow *hb = &host_hash[u];
+ HRLOCK_LOCK(hb);
+ while (h) {
+ if ((SC_ATOMIC_GET(h->use_cnt) > 0) && (h->iprep != NULL)) {
+ /* iprep is attached to host only clear tag and threshold */
+ if (h->tag != NULL) {
+ DetectTagDataListFree(h->tag);
+ h->tag = NULL;
+ }
+ if (h->threshold != NULL) {
+ ThresholdListFree(h->threshold);
+ h->threshold = NULL;
+ }
+ h = h->hnext;
+ } else {
+ Host *n = h->hnext;
+ /* remove from the hash */
+ if (h->hprev != NULL)
+ h->hprev->hnext = h->hnext;
+ if (h->hnext != NULL)
+ h->hnext->hprev = h->hprev;
+ if (hb->head == h)
+ hb->head = h->hnext;
+ if (hb->tail == h)
+ hb->tail = h->hprev;
+ h->hnext = NULL;
+ h->hprev = NULL;
+ HostClearMemory(h);
+ HostMoveToSpare(h);
+ h = n;
+ }
+ }
+ HRLOCK_UNLOCK(hb);
+ }
+ }
+
+ return;
+}
+
/* calculate the hash key for this packet
*
* we're using:
void HostInitConfig(char quiet);
void HostShutdown(void);
+void HostCleanup(void);
Host *HostLookupHostFromHash (Address *);
Host *HostGetHostFromHash (Address *);
SCPerfReleaseResources();
/* thread killed, we can run non thread-safe shutdown functions */
FlowShutdown();
- HostShutdown();
+ HostCleanup();
StreamTcpFreeConfig(STREAM_VERBOSE);
DefragDestroy();
TmqResetQueues();
PcapFilesFree(cfile);
SCPerfInitCounterApi();
DefragInit();
- HostInitConfig(HOST_QUIET);
FlowInitConfig(FLOW_QUIET);
StreamTcpInitConfig(STREAM_VERBOSE);
RunModeInitializeOutputs();
#endif /* OS_WIN32 */
PacketPoolInit(max_pending_packets);
+ HostInitConfig(HOST_VERBOSE);
if (run_mode != RUNMODE_UNIX_SOCKET) {
- HostInitConfig(HOST_VERBOSE);
FlowInitConfig(FLOW_VERBOSE);
}
if (run_mode != RUNMODE_UNIX_SOCKET) {
SCPerfReleaseResources();
FlowShutdown();
- HostShutdown();
StreamTcpFreeConfig(STREAM_VERBOSE);
}
+ HostShutdown();
HTPFreeConfig();
HTPAtExitPrintStats();