|
|
|
|
@ -128,7 +128,6 @@ void *FlowManagerThread(void *td)
|
|
|
|
|
ThreadVars *th_v = (ThreadVars *)td;
|
|
|
|
|
struct timeval ts;
|
|
|
|
|
uint32_t established_cnt = 0, new_cnt = 0, closing_cnt = 0, nowcnt;
|
|
|
|
|
uint32_t sleeping = 0;
|
|
|
|
|
int emerg = FALSE;
|
|
|
|
|
int prev_emerg = FALSE;
|
|
|
|
|
uint32_t last_sec = 0;
|
|
|
|
|
@ -177,10 +176,6 @@ void *FlowManagerThread(void *td)
|
|
|
|
|
{
|
|
|
|
|
TmThreadTestThreadUnPaused(th_v);
|
|
|
|
|
|
|
|
|
|
//if ((counter > NEW_FLOW_COUNT_COND) || (flow_flags & FLOW_EMERGENCY)) {
|
|
|
|
|
{
|
|
|
|
|
//counter = 0;
|
|
|
|
|
|
|
|
|
|
if (flow_flags & FLOW_EMERGENCY) {
|
|
|
|
|
emerg = TRUE;
|
|
|
|
|
|
|
|
|
|
@ -238,8 +233,6 @@ void *FlowManagerThread(void *td)
|
|
|
|
|
long long unsigned int flow_memuse = SC_ATOMIC_GET(flow_memuse);
|
|
|
|
|
SCPerfCounterSetUI64(flow_mgr_memuse, th_v->sc_perf_pca, (uint64_t)flow_memuse);
|
|
|
|
|
|
|
|
|
|
sleeping = 0;
|
|
|
|
|
|
|
|
|
|
/* Don't fear, FlowManagerThread is here...
|
|
|
|
|
* clear emergency bit if we have at least xx flows pruned. */
|
|
|
|
|
if (emerg == TRUE) {
|
|
|
|
|
@ -274,46 +267,17 @@ void *FlowManagerThread(void *td)
|
|
|
|
|
flow_update_delay_nsec = FLOW_EMERG_MODE_UPDATE_DELAY_NSEC;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (TmThreadsCheckFlag(th_v, THV_KILL)) {
|
|
|
|
|
SCPerfSyncCounters(th_v, 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
if (run_mode != RUNMODE_PCAP_FILE) {
|
|
|
|
|
#endif
|
|
|
|
|
cond_time.tv_sec = time(NULL) + flow_update_delay_sec;
|
|
|
|
|
cond_time.tv_nsec = flow_update_delay_nsec;
|
|
|
|
|
SCMutexLock(&flow_manager_mutex);
|
|
|
|
|
SCCondTimedwait(&flow_manager_cond, &flow_manager_mutex, &cond_time);
|
|
|
|
|
SCMutexUnlock(&flow_manager_mutex);
|
|
|
|
|
#if 0
|
|
|
|
|
} else {
|
|
|
|
|
/* If we are reading a pcap, how long the pcap timestamps
|
|
|
|
|
* says that has passed */
|
|
|
|
|
memset(&tsdiff, 0, sizeof(tsdiff));
|
|
|
|
|
TimeGet(&tsdiff);
|
|
|
|
|
|
|
|
|
|
if (tsdiff.tv_sec == ts.tv_sec &&
|
|
|
|
|
tsdiff.tv_usec > ts.tv_usec &&
|
|
|
|
|
tsdiff.tv_usec - ts.tv_usec < 10) {
|
|
|
|
|
/* if it has passed less than 10 usec, sleep that usecs */
|
|
|
|
|
sleeping += tsdiff.tv_usec - ts.tv_usec;
|
|
|
|
|
usleep(tsdiff.tv_usec - ts.tv_usec);
|
|
|
|
|
} else {
|
|
|
|
|
/* Else update the sleeping var but don't sleep so long */
|
|
|
|
|
if (tsdiff.tv_sec == ts.tv_sec && tsdiff.tv_usec > ts.tv_usec)
|
|
|
|
|
sleeping += tsdiff.tv_usec - ts.tv_usec;
|
|
|
|
|
else if (tsdiff.tv_sec == ts.tv_sec + 1)
|
|
|
|
|
sleeping += tsdiff.tv_usec + (1000000 - ts.tv_usec);
|
|
|
|
|
else
|
|
|
|
|
sleeping += 100;
|
|
|
|
|
usleep(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
SCPerfSyncCountersIfSignalled(th_v, 0);
|
|
|
|
|
}
|
|
|
|
|
|