Let the queues code set up PacketQueues on demand.
void GlobalsInitPreConfig(void)
{
- memset(trans_q, 0, sizeof(trans_q));
-
- /* Initialize the trans_q mutex */
- int blah;
- int r = 0;
- for(blah=0;blah<256;blah++) {
- r |= SCMutexInit(&trans_q[blah].mutex_q, NULL);
- r |= SCCondInit(&trans_q[blah].cond_q, NULL);
- }
-
- if (r != 0) {
- SCLogInfo("Trans_Q Mutex not initialized correctly");
- exit(EXIT_FAILURE);
- }
-
TimeInit();
SupportFastPatternForSigMatchTypes();
SCThresholdConfGlobalInit();
#include "runmodes.h"
-/* queue's between various other threads
- * XXX move to the TmQueue structure later
- */
-PacketQueue trans_q[256];
-
typedef struct SCInstance_ {
enum RunModes run_mode;
enum RunModes aux_run_mode;
q->id = tmq_id++;
q->is_packet_pool = (strcmp(q->name, "packetpool") == 0);
- q->pq = &trans_q[q->id];
+ q->pq = PacketQueueAlloc();
+ if (q->pq == NULL)
+ goto error;
SCLogDebug("created queue \'%s\', %p", name, q);
return q;
error:
- SCLogError(SC_ERR_THREAD_QUEUE, "too many thread queues %u, max is %u", tmq_id+1, TMQ_MAX_QUEUES);
+ SCLogError(SC_ERR_THREAD_QUEUE, "thread queue setup failed for '%s'", name);
return NULL;
}
if (tmqs[i].name) {
SCFree(tmqs[i].name);
}
+ if (tmqs[i].pq) {
+ PacketQueueFree(tmqs[i].pq);
+ }
}
memset(&tmqs, 0x00, sizeof(tmqs));
tmq_id = 0;