stream: remove flow reference from StreamMsg

StreamMsg' flow reference was used mostly to make sure a flow would
not get removed from the hash before inspection. For this it needed
to reference the flow use_cnt reference counter. Nowadays we have
more advanced flow timeout handling. This will make sure that if
there still are pending smsgs' in a flow, these will still be
processed.
pull/759/head
Victor Julien 13 years ago
parent 1d08a3ff26
commit b159c1714c

@ -375,7 +375,6 @@ int AppLayerHandleTCPMsg(StreamMsg *smsg, TcpSession *ssn)
printf("=> Stream Data -- end\n");
#endif
SCLogDebug("smsg %p", smsg);
BUG_ON(smsg->flow == NULL);
if (ssn != NULL) {
SCLogDebug("storing smsg %p in the tcp session", smsg);
@ -415,14 +414,11 @@ int AppLayerHandleTCPMsg(StreamMsg *smsg, TcpSession *ssn)
}
}
FlowDeReference(&smsg->flow);
} else { /* no ssn ptr */
/* if there is no ssn ptr we won't
* be inspecting this msg in detect
* so return it to the pool. */
FlowDeReference(&smsg->flow);
/* return the used message to the queue */
StreamMsgReturnToPool(smsg);
}

@ -1751,8 +1751,6 @@ static void StreamTcpSetupMsg(TcpSession *ssn, TcpStream *stream, Packet *p,
}
smsg->data_len = 0;
FlowReference(&smsg->flow, p->flow);
BUG_ON(smsg->flow == NULL);
SCLogDebug("smsg %p", smsg);
SCReturn;
@ -3403,15 +3401,13 @@ int StreamTcpReassembleProcessAppLayer(TcpReassemblyThreadCtx *ra_ctx, TcpSessio
do {
smsg = StreamMsgGetFromQueue(ra_ctx->stream_q);
if (smsg != NULL) {
SCLogDebug("smsg %p, next %p, prev %p, flow %p, q->len %u, "
SCLogDebug("smsg %p, next %p, prev %p, q->len %u, "
"smsg->datalen %u, direction %s%s",
smsg, smsg->next, smsg->prev, smsg->flow,
smsg, smsg->next, smsg->prev,
ra_ctx->stream_q->len, smsg->data_len,
smsg->flags & STREAM_TOSERVER ? "toserver":"",
smsg->flags & STREAM_TOCLIENT ? "toclient":"");
BUG_ON(smsg->flow == NULL);
//PrintRawDataFp(stderr, smsg->data, smsg->data_len);
/* Handle the stream msg. No need to use locking, flow is

@ -196,7 +196,6 @@ void StreamTcpSessionClear(void *ssnptr)
SCLogDebug("returning smsg %p to pool", smsg);
smsg->next = NULL;
smsg->prev = NULL;
FlowDeReference(&smsg->flow);
StreamMsgReturnToPool(smsg);
smsg = smsg_next;
}
@ -208,7 +207,6 @@ void StreamTcpSessionClear(void *ssnptr)
SCLogDebug("returning smsg %p to pool", smsg);
smsg->next = NULL;
smsg->prev = NULL;
FlowDeReference(&smsg->flow);
StreamMsgReturnToPool(smsg);
smsg = smsg_next;
}
@ -306,7 +304,6 @@ void StreamTcpSessionPoolCleanup(void *s)
SCLogDebug("returning smsg %p to pool", smsg);
smsg->next = NULL;
smsg->prev = NULL;
FlowDeReference(&smsg->flow);
StreamMsgReturnToPool(smsg);
smsg = smsg_next;
}
@ -318,7 +315,6 @@ void StreamTcpSessionPoolCleanup(void *s)
SCLogDebug("returning smsg %p to pool", smsg);
smsg->next = NULL;
smsg->prev = NULL;
FlowDeReference(&smsg->flow);
StreamMsgReturnToPool(smsg);
smsg = smsg_next;
}

@ -216,7 +216,6 @@ void StreamMsgReturnListToPool(void *list) {
SCLogDebug("returning smsg %p to pool", smsg);
smsg->next = NULL;
smsg->prev = NULL;
FlowDeReference(&smsg->flow);
StreamMsgReturnToPool(smsg);
smsg = smsg_next;
}

@ -38,7 +38,6 @@
typedef struct StreamMsg_ {
uint8_t flags; /**< msg flags */
Flow *flow; /**< parent flow */
struct StreamMsg_ *next;
struct StreamMsg_ *prev;

Loading…
Cancel
Save