• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

OISF / suricata / 23338889526

20 Mar 2026 10:29AM UTC coverage: 76.331% (-3.0%) from 79.315%
23338889526

Pull #15053

github

web-flow
Merge 00ac1dd14 into 6587e363a
Pull Request #15053: Flow queue/v3

106 of 127 new or added lines in 8 files covered. (83.46%)

9913 existing lines in 468 files now uncovered.

255689 of 334972 relevant lines covered (76.33%)

4170649.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

16.67
/src/tmqh-simple.c
1
/* Copyright (C) 2007-2013 Open Information Security Foundation
2
 *
3
 * You can copy, redistribute or modify this Program under the terms of
4
 * the GNU General Public License version 2 as published by the Free
5
 * Software Foundation.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 * GNU General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU General Public License
13
 * version 2 along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15
 * 02110-1301, USA.
16
 */
17

18
/**
19
 * \file
20
 *
21
 * \author Victor Julien <victor@inliniac.net>
22
 *
23
 * Simple queue handler
24
 */
25

26
#include "suricata.h"
27
#include "packet-queue.h"
28
#include "decode.h"
29
#include "threads.h"
30
#include "threadvars.h"
31

32
#include "tm-queuehandlers.h"
33
#include "tmqh-simple.h"
34

35
static PacketQueueNoLock TmqhInputSimple(ThreadVars *t);
36
static void TmqhOutputSimple(ThreadVars *t, Packet *p);
37
static void TmqhInputSimpleShutdownHandler(ThreadVars *);
38

39
void TmqhSimpleRegister (void)
40
{
2,215✔
41
    tmqh_table[TMQH_SIMPLE].name = "simple";
2,215✔
42
    tmqh_table[TMQH_SIMPLE].InHandler = TmqhInputSimple;
2,215✔
43
    tmqh_table[TMQH_SIMPLE].InShutdownHandler = TmqhInputSimpleShutdownHandler;
2,215✔
44
    tmqh_table[TMQH_SIMPLE].OutHandler = TmqhOutputSimple;
2,215✔
45
}
2,215✔
46

47
PacketQueueNoLock TmqhInputSimple(ThreadVars *tv)
UNCOV
48
{
×
NEW
49
    StatsSyncCountersIfSignalled(&tv->stats);
×
50

NEW
51
    PacketQueue *q = tv->inq->pq;
×
UNCOV
52
    SCMutexLock(&q->mutex_q);
×
UNCOV
53
    if (q->len == 0) {
×
54
        /* if we have no packets in queue, wait... */
UNCOV
55
        SCCondWait(&q->cond_q, &q->mutex_q);
×
UNCOV
56
    }
×
NEW
57
    PacketQueueNoLock pq = { .top = q->top, .bot = q->bot, q->len };
×
NEW
58
    SCMutexUnlock(&q->mutex_q);
×
NEW
59
    return pq;
×
UNCOV
60
}
×
61

62
static void TmqhInputSimpleShutdownHandler(ThreadVars *tv)
UNCOV
63
{
×
UNCOV
64
    int i;
×
65

UNCOV
66
    if (tv == NULL || tv->inq == NULL) {
×
67
        return;
×
68
    }
×
69

UNCOV
70
    for (i = 0; i < (tv->inq->reader_cnt + tv->inq->writer_cnt); i++) {
×
UNCOV
71
        SCMutexLock(&tv->inq->pq->mutex_q);
×
UNCOV
72
        SCCondSignal(&tv->inq->pq->cond_q);
×
UNCOV
73
        SCMutexUnlock(&tv->inq->pq->mutex_q);
×
UNCOV
74
    }
×
UNCOV
75
}
×
76

77
static void TmqhOutputSimple(ThreadVars *t, Packet *p)
UNCOV
78
{
×
UNCOV
79
    SCLogDebug("Packet %p, p->root %p, alloced %s", p, p->root, BOOL2STR(p->pool == NULL));
×
80

UNCOV
81
    PacketQueue *q = t->outq->pq;
×
82

UNCOV
83
    SCMutexLock(&q->mutex_q);
×
UNCOV
84
    PacketEnqueue(q, p);
×
UNCOV
85
    SCCondSignal(&q->cond_q);
×
UNCOV
86
    SCMutexUnlock(&q->mutex_q);
×
UNCOV
87
}
×
88

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc