stream: remove lock from StreamTcpSegmentForEach

This is only entered from logging functions which are already
called with a locked flow.
pull/2245/head
Jason Ish 9 years ago committed by Victor Julien
parent 55f2704a25
commit 688e8dbe7f

@ -5723,6 +5723,8 @@ void StreamTcpPseudoPacketCreateStreamEndPacket(ThreadVars *tv, StreamTcpThread
* \note when stream engine is running in inline mode all segments are used,
* in IDS/non-inline mode only ack'd segments are iterated.
*
* \note Must be called under flow lock.
*
* \return -1 in case of error, the number of segment in case of success
*
*/
@ -5736,11 +5738,9 @@ int StreamTcpSegmentForEach(const Packet *p, uint8_t flag, StreamSegmentCallback
if (p->flow == NULL)
return 0;
FLOWLOCK_RDLOCK(p->flow);
ssn = (TcpSession *)p->flow->protoctx;
if (ssn == NULL) {
FLOWLOCK_UNLOCK(p->flow);
return 0;
}
@ -5758,13 +5758,11 @@ int StreamTcpSegmentForEach(const Packet *p, uint8_t flag, StreamSegmentCallback
ret = CallbackFunc(p, data, seg->payload, seg->payload_len);
if (ret != 1) {
SCLogDebug("Callback function has failed");
FLOWLOCK_UNLOCK(p->flow);
return -1;
}
seg = seg->next;
cnt++;
}
FLOWLOCK_UNLOCK(p->flow);
return cnt;
}

@ -268,6 +268,8 @@ void StreamMsgReturnListToPool(void *list)
}
/** \brief Run callback for all segments
*
* Must be called under flow lock.
*
* \return -1 in case of error, the number of segment in case of success
*/

Loading…
Cancel
Save