/* okay, we need to setup a new flow for this packet.
* Flag the flow that it's been replaced by a new one */
f->flags |= FLOW_TCP_REUSED;
- SCLogDebug("flow obsolete: TCP reuse will use a new flow");
+ SCLogDebug("flow obsolete: TCP reuse will use a new flow "
+ "starting with packet %"PRIu64, p->pcap_cnt);
return 0;
}
return 1;
#include "util-profiling.h"
#include "util-misc.h"
#include "util-validate.h"
+#include "util-runmodes.h"
#include "source-pcap-file.h"
return;
}
+ SCLogDebug("steam starter packet %"PRIu64", and state "
+ "ready to be reused", p->pcap_cnt);
+
/* ok, this packet needs a new flow */
/* first, get a reference to the old flow */
p->flags |= PKT_IGNORE_CHECKSUM;
}
-// TODO autofp only somehow
- /* "autofp" handling of TCP session/flow reuse */
- if (!(p->flags & PKT_PSEUDO_STREAM_END)) {
- /* apply previous reuses to this packet */
- TcpSessionReuseHandleApplyToPacket(p);
- if (p->flow == NULL)
- return ret;
+ if (stt->runmode_flow_stream_async) {
+ /* "autofp" handling of TCP session/flow reuse */
+ if (!(p->flags & PKT_PSEUDO_STREAM_END)) {
+ /* apply previous reuses to this packet */
+ TcpSessionReuseHandleApplyToPacket(p);
+ if (p->flow == NULL)
+ return ret;
- /* after that, check for 'new' reuse */
- TcpSessionReuseHandle(p);
- if (p->flow == NULL)
- return ret;
+ /* after that, check for 'new' reuse */
+ TcpSessionReuseHandle(p);
+ if (p->flow == NULL)
+ return ret;
+ }
}
-
AppLayerProfilingReset(stt->ra_ctx->app_tctx);
FLOWLOCK_WRLOCK(p->flow);
if (stt->ssn_pool_id < 0 || ssn_pool == NULL)
SCReturnInt(TM_ECODE_FAILED);
+ /* see if need to enable the TCP reuse handling in the stream engine */
+ stt->runmode_flow_stream_async = RunmodeGetFlowStreamAsync();
+ SCLogDebug("Flow and Stream engine run %s",
+ stt->runmode_flow_stream_async ? "asynchronous" : "synchronous");
+
SCReturnInt(TM_ECODE_OK);
}
#include "util-runmodes.h"
+/** set to true if flow engine and stream engine run in different
+ * threads. */
+static int runmode_flow_stream_async = 0;
+
+void RunmodeSetFlowStreamAsync(void)
+{
+ runmode_flow_stream_async = 1;
+}
+
+int RunmodeGetFlowStreamAsync(void)
+{
+ return runmode_flow_stream_async;
+}
+
/** \brief create a queue string for autofp to pass to
* the flow queue handler.
*
if (thread_max < 1)
thread_max = 1;
+ RunmodeSetFlowStreamAsync();
+
queues = RunmodeAutoFpCreatePickupQueuesString(thread_max);
if (queues == NULL) {
SCLogError(SC_ERR_RUNMODE, "RunmodeAutoFpCreatePickupQueuesString failed");
if (thread_max < 1)
thread_max = 1;
+ RunmodeSetFlowStreamAsync();
+
queues = RunmodeAutoFpCreatePickupQueuesString(thread_max);
if (queues == NULL) {
SCLogError(SC_ERR_RUNMODE, "RunmodeAutoFpCreatePickupQueuesString failed");