From c4e13246901c62851affd299e8f8e55395978304 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 17 Dec 2014 17:15:38 +0100 Subject: [PATCH] flow-timeout: use packet pool Use packet pool for pseudo packets on flow timeout. Wait for a packet if necessary. For shutdown, alloc a new pool as the 'main()' thread calls this. --- src/flow-timeout.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/flow-timeout.c b/src/flow-timeout.c index 36391783f0..a3de51da64 100644 --- a/src/flow-timeout.c +++ b/src/flow-timeout.c @@ -238,11 +238,13 @@ static inline Packet *FlowForceReassemblyPseudoPacketGet(int direction, TcpSession *ssn, int dummy) { - Packet *p; - - p = PacketGetFromAlloc(); - if (p == NULL) + PacketPoolWait(); + Packet *p = PacketPoolGetPacket(); + if (p == NULL) { return NULL; + } + + PACKET_PROFILING_START(p); return FlowForceReassemblyPseudoPacketSetup(p, direction, f, ssn, dummy); } @@ -535,9 +537,11 @@ static inline void FlowForceReassemblyForHash(void) */ void FlowForceReassembly(void) { + /* called by 'main()' which has no packet pool */ + PacketPoolInit(); /* Carry out flow reassembly for unattended flows */ FlowForceReassemblyForHash(); - + PacketPoolDestroy(); return; }