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

OISF / suricata / 23374838686

21 Mar 2026 07:29AM UTC coverage: 59.341% (-20.0%) from 79.315%
23374838686

Pull #15075

github

web-flow
Merge 90b4e834f into 6587e363a
Pull Request #15075: Stack 8001 v16.4

38 of 70 new or added lines in 10 files covered. (54.29%)

34165 existing lines in 563 files now uncovered.

119621 of 201584 relevant lines covered (59.34%)

650666.92 hits per line

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

14.63
/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
Packet *TmqhInputSimple(ThreadVars *t);
36
void TmqhOutputSimple(ThreadVars *t, Packet *p);
37
void TmqhInputSimpleShutdownHandler(ThreadVars *);
38

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

47
Packet *TmqhInputSimple(ThreadVars *t)
UNCOV
48
{
×
UNCOV
49
    PacketQueue *q = t->inq->pq;
×
50

UNCOV
51
    StatsSyncCountersIfSignalled(&t->stats);
×
52

UNCOV
53
    SCMutexLock(&q->mutex_q);
×
54

UNCOV
55
    if (q->len == 0) {
×
56
        /* if we have no packets in queue, wait... */
UNCOV
57
        SCCondWait(&q->cond_q, &q->mutex_q);
×
UNCOV
58
    }
×
59

UNCOV
60
    if (q->len > 0) {
×
UNCOV
61
        Packet *p = PacketDequeue(q);
×
UNCOV
62
        SCMutexUnlock(&q->mutex_q);
×
UNCOV
63
        return p;
×
UNCOV
64
    } else {
×
65
        /* return NULL if we have no pkt. Should only happen on signals. */
UNCOV
66
        SCMutexUnlock(&q->mutex_q);
×
UNCOV
67
        return NULL;
×
UNCOV
68
    }
×
UNCOV
69
}
×
70

71
void TmqhInputSimpleShutdownHandler(ThreadVars *tv)
UNCOV
72
{
×
UNCOV
73
    int i;
×
74

UNCOV
75
    if (tv == NULL || tv->inq == NULL) {
×
76
        return;
×
77
    }
×
78

UNCOV
79
    for (i = 0; i < (tv->inq->reader_cnt + tv->inq->writer_cnt); i++) {
×
UNCOV
80
        SCMutexLock(&tv->inq->pq->mutex_q);
×
UNCOV
81
        SCCondSignal(&tv->inq->pq->cond_q);
×
UNCOV
82
        SCMutexUnlock(&tv->inq->pq->mutex_q);
×
UNCOV
83
    }
×
UNCOV
84
}
×
85

86
void TmqhOutputSimple(ThreadVars *t, Packet *p)
UNCOV
87
{
×
UNCOV
88
    SCLogDebug("Packet %p, p->root %p, alloced %s", p, p->root, BOOL2STR(p->pool == NULL));
×
89

UNCOV
90
    PacketQueue *q = t->outq->pq;
×
91

UNCOV
92
    SCMutexLock(&q->mutex_q);
×
UNCOV
93
    PacketEnqueue(q, p);
×
UNCOV
94
    SCCondSignal(&q->cond_q);
×
UNCOV
95
    SCMutexUnlock(&q->mutex_q);
×
UNCOV
96
}
×
97

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