diff --git a/src/stream-tcp.c b/src/stream-tcp.c index 4c3467d53a..8f6ddf8b98 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -345,13 +345,16 @@ void StreamTcpSessionPoolFree(void *s) void StreamTcpInitConfig(char quiet) { + intmax_t value = 0; + SCLogDebug("Initializing Stream"); memset(&stream_config, 0, sizeof(stream_config)); /** set config defaults */ - if ((ConfGetInt("stream.max_sessions", (intmax_t *)&stream_config.max_sessions)) == 0) - { + if ((ConfGetInt("stream.max_sessions", &value)) == 1) { + stream_config.max_sessions = (uint32_t)value; + } else { if (RunmodeIsUnittests()) stream_config.max_sessions = 1024; else @@ -361,9 +364,9 @@ void StreamTcpInitConfig(char quiet) SCLogInfo("stream \"max_sessions\": %"PRIu32"", stream_config.max_sessions); } - if ((ConfGetInt("stream.prealloc_sessions", - (intmax_t *)&stream_config.prealloc_sessions)) == 0) - { + if ((ConfGetInt("stream.prealloc_sessions", &value)) == 1) { + stream_config.prealloc_sessions = (uint32_t)value; + } else { if (RunmodeIsUnittests()) stream_config.prealloc_sessions = 128; else @@ -373,8 +376,9 @@ void StreamTcpInitConfig(char quiet) SCLogInfo("stream \"prealloc_sessions\": %"PRIu32"", stream_config.prealloc_sessions); } - if ((ConfGetInt("stream.memcap", (intmax_t *)&stream_config.memcap)) == 0) - { + if ((ConfGetInt("stream.memcap", &value)) == 1) { + stream_config.memcap = (uint32_t)value; + } else { stream_config.memcap = STREAMTCP_DEFAULT_MEMCAP; } if (!quiet) { diff --git a/src/stream-tcp.h b/src/stream-tcp.h index 3744b719c6..10df32e361 100644 --- a/src/stream-tcp.h +++ b/src/stream-tcp.h @@ -38,8 +38,8 @@ /*global flow data*/ typedef struct TcpStreamCnf_ { uint32_t memcap; /** max stream mem usage */ - int max_sessions; - int prealloc_sessions; + uint32_t max_sessions; + uint32_t prealloc_sessions; int midstream; int async_oneside; } TcpStreamCnf;