}
size_t loggable = (size_t)r;
+ /* nothing to do */
+ if (logged >= loggable) {
+ goto end;
+ }
+
HtpState *htp_state = (HtpState *)AppLayerGetProtoStateFromPacket(p);
if (htp_state == NULL) {
SCLogDebug("no http state, so no request logging");
dp = p->sp;
}
- SCMutexLock(&hlog->file_ctx->fp_mutex);
for (idx = logged; idx < loggable; idx++)
{
tx = list_get(htp_state->connp->conn->transactions, idx);
continue;
}
+ /* output now starting, so get output lock */
+ SCMutexLock(&hlog->file_ctx->fp_mutex);
+
SCLogDebug("got a HTTP request and now logging !!");
/* time */
fprintf(hlog->file_ctx->fp, "%s ", timebuf);
srcip, sp, dstip, dp);
aft->uri_cnt ++;
+ fflush(hlog->file_ctx->fp);
+ SCMutexUnlock(&hlog->file_ctx->fp_mutex);
AppLayerTransactionUpdateLoggedId(p->flow);
}
- fflush(hlog->file_ctx->fp);
- SCMutexUnlock(&hlog->file_ctx->fp_mutex);
end:
SCMutexUnlock(&p->flow->m);