|
|
@ -2216,7 +2216,6 @@ end:
|
|
|
|
SCMutexUnlock(&thread_store_lock);
|
|
|
|
SCMutexUnlock(&thread_store_lock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define COPY_TIMESTAMP(src,dst) ((dst)->tv_sec = (src)->tv_sec, (dst)->tv_usec = (src)->tv_usec) // XXX unify with flow-util.h
|
|
|
|
|
|
|
|
void TmThreadsSetThreadTimestamp(const int id, const struct timeval *ts)
|
|
|
|
void TmThreadsSetThreadTimestamp(const int id, const struct timeval *ts)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SCMutexLock(&thread_store_lock);
|
|
|
|
SCMutexLock(&thread_store_lock);
|
|
|
@ -2227,7 +2226,7 @@ void TmThreadsSetThreadTimestamp(const int id, const struct timeval *ts)
|
|
|
|
|
|
|
|
|
|
|
|
int idx = id - 1;
|
|
|
|
int idx = id - 1;
|
|
|
|
Thread *t = &thread_store.threads[idx];
|
|
|
|
Thread *t = &thread_store.threads[idx];
|
|
|
|
COPY_TIMESTAMP(ts, &t->pktts);
|
|
|
|
t->pktts = *ts;
|
|
|
|
struct timeval systs;
|
|
|
|
struct timeval systs;
|
|
|
|
gettimeofday(&systs, NULL);
|
|
|
|
gettimeofday(&systs, NULL);
|
|
|
|
t->sys_sec_stamp = (uint32_t)systs.tv_sec;
|
|
|
|
t->sys_sec_stamp = (uint32_t)systs.tv_sec;
|
|
|
@ -2260,7 +2259,7 @@ void TmThreadsInitThreadsTimestamp(const struct timeval *ts)
|
|
|
|
Thread *t = &thread_store.threads[s];
|
|
|
|
Thread *t = &thread_store.threads[s];
|
|
|
|
if (!t->in_use)
|
|
|
|
if (!t->in_use)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
COPY_TIMESTAMP(ts, &t->pktts);
|
|
|
|
t->pktts = *ts;
|
|
|
|
t->sys_sec_stamp = (uint32_t)systs.tv_sec;
|
|
|
|
t->sys_sec_stamp = (uint32_t)systs.tv_sec;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SCMutexUnlock(&thread_store_lock);
|
|
|
|
SCMutexUnlock(&thread_store_lock);
|
|
|
@ -2287,21 +2286,19 @@ void TmThreadsGetMinimalTimestamp(struct timeval *ts)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
if (!set) {
|
|
|
|
if (!set) {
|
|
|
|
local.tv_sec = t->pktts.tv_sec;
|
|
|
|
local = t->pktts;
|
|
|
|
local.tv_usec = t->pktts.tv_usec;
|
|
|
|
|
|
|
|
set = 1;
|
|
|
|
set = 1;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (timercmp(&t->pktts, &local, <)) {
|
|
|
|
if (timercmp(&t->pktts, &local, <)) {
|
|
|
|
COPY_TIMESTAMP(&t->pktts, &local);
|
|
|
|
local = t->pktts;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SCMutexUnlock(&thread_store_lock);
|
|
|
|
SCMutexUnlock(&thread_store_lock);
|
|
|
|
COPY_TIMESTAMP(&local, ts);
|
|
|
|
*ts = local;
|
|
|
|
SCLogDebug("ts->tv_sec %"PRIuMAX, (uintmax_t)ts->tv_sec);
|
|
|
|
SCLogDebug("ts->tv_sec %"PRIuMAX, (uintmax_t)ts->tv_sec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#undef COPY_TIMESTAMP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* \retval r 1 if packet was accepted, 0 otherwise
|
|
|
|
* \retval r 1 if packet was accepted, 0 otherwise
|
|
|
|