unix socket: improve runmode handling

Improve output of unix mode in --list-runmodes

Honor the runmode commandline setting. Supported are 'single'
and 'autofp', with the latter still the default.
pull/2729/head
Victor Julien 9 years ago
parent 75edfcc2cd
commit 43b0bc8c8e

@ -67,7 +67,7 @@ const char *RunModeUnixSocketGetDefaultMode(void)
#ifdef BUILD_UNIX_SOCKET #ifdef BUILD_UNIX_SOCKET
static int RunModeUnixSocketSingle(void); static int RunModeUnixSocketMaster(void);
static int unix_manager_file_task_running = 0; static int unix_manager_file_task_running = 0;
static int unix_manager_file_task_failed = 0; static int unix_manager_file_task_failed = 0;
@ -351,6 +351,7 @@ static TmEcode UnixSocketPcapFilesCheck(void *data)
RunModeDispatch(RUNMODE_PCAP_FILE, NULL); RunModeDispatch(RUNMODE_PCAP_FILE, NULL);
/* Un-pause all the paused threads */ /* Un-pause all the paused threads */
TmThreadWaitOnThreadInit();
TmThreadContinueThreads(); TmThreadContinueThreads();
return TM_ECODE_OK; return TM_ECODE_OK;
} }
@ -359,10 +360,14 @@ static TmEcode UnixSocketPcapFilesCheck(void *data)
void RunModeUnixSocketRegister(void) void RunModeUnixSocketRegister(void)
{ {
#ifdef BUILD_UNIX_SOCKET #ifdef BUILD_UNIX_SOCKET
/* a bit of a hack, but register twice to --list-runmodes shows both */
RunModeRegisterNewRunMode(RUNMODE_UNIX_SOCKET, "single", RunModeRegisterNewRunMode(RUNMODE_UNIX_SOCKET, "single",
"Unix socket mode", "Unix socket mode",
RunModeUnixSocketSingle); RunModeUnixSocketMaster);
default_mode = "single"; RunModeRegisterNewRunMode(RUNMODE_UNIX_SOCKET, "autofp",
"Unix socket mode",
RunModeUnixSocketMaster);
default_mode = "autofp";
#endif #endif
return; return;
} }
@ -1012,7 +1017,7 @@ TmEcode UnixSocketHostbitList(json_t *cmd, json_t* answer, void *data_unused)
/** /**
* \brief Single thread version of the Pcap file processing. * \brief Single thread version of the Pcap file processing.
*/ */
static int RunModeUnixSocketSingle(void) static int RunModeUnixSocketMaster(void)
{ {
if (UnixManagerInit() != 0) if (UnixManagerInit() != 0)
return 1; return 1;

@ -2584,6 +2584,10 @@ static int PostConfLoadedSetup(SCInstance *suri)
break; break;
} }
if (suri->runmode_custom_mode) {
ConfSet("runmode", suri->runmode_custom_mode);
}
AppLayerSetup(); AppLayerSetup();
/* Check for the existance of the default logging directory which we pick /* Check for the existance of the default logging directory which we pick

Loading…
Cancel
Save