fix: cppcheck
This commit is contained in:
@@ -14,7 +14,9 @@
|
||||
#include "packet_dump.h"
|
||||
#include "packet_parse.h"
|
||||
#include "stellar/packet.h"
|
||||
#include "stellar/session_mq.h"
|
||||
#include "stellar/stellar_mq.h"
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
|
||||
// NOTE: packet hexdump or tcp segment hexdump may be too long, so we need direct output to fd, instead of using log_print
|
||||
static void log_print(int fd, const char *module, const char *fmt, ...)
|
||||
@@ -88,6 +90,11 @@ static void on_sess_free(struct session *sess, void *sess_ctx, void *plugin_ctx)
|
||||
|
||||
static void on_sess_udp_msg(struct session *sess, int topic_id, const void *msg, void *sess_ctx, void *plugin_ctx)
|
||||
{
|
||||
if (msg == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char buff[4096];
|
||||
struct packet *pkt = (struct packet *)msg;
|
||||
struct plugin_ctx *ctx = (struct plugin_ctx *)plugin_ctx;
|
||||
@@ -107,6 +114,11 @@ static void on_sess_udp_msg(struct session *sess, int topic_id, const void *msg,
|
||||
|
||||
static void on_sess_tcp_msg(struct session *sess, int topic_id, const void *msg, void *sess_ctx, void *plugin_ctx)
|
||||
{
|
||||
if (msg == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char buff[4096];
|
||||
struct packet *pkt = (struct packet *)msg;
|
||||
struct plugin_ctx *ctx = (struct plugin_ctx *)plugin_ctx;
|
||||
@@ -126,6 +138,11 @@ static void on_sess_tcp_msg(struct session *sess, int topic_id, const void *msg,
|
||||
|
||||
static void on_sess_tcp_stream_msg(struct session *sess, int topic_id, const void *msg, void *sess_ctx, void *plugin_ctx)
|
||||
{
|
||||
if (msg == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char buff[4096];
|
||||
struct tcp_segment *seg = (struct tcp_segment *)msg;
|
||||
struct plugin_ctx *ctx = (struct plugin_ctx *)plugin_ctx;
|
||||
@@ -166,9 +183,9 @@ extern "C"
|
||||
|
||||
ctx->st = st;
|
||||
ctx->sess_plug_id = stellar_session_plugin_register(st, on_sess_new, on_sess_free, ctx);
|
||||
ctx->udp_topic_id = stellar_session_mq_get_topic_id(st, TOPIC_UDP);
|
||||
ctx->tcp_topic_id = stellar_session_mq_get_topic_id(st, TOPIC_TCP);
|
||||
ctx->tcp_stream_topic_id = stellar_session_mq_get_topic_id(st, TOPIC_TCP_STREAM);
|
||||
ctx->udp_topic_id = stellar_mq_get_topic_id(st, TOPIC_UDP);
|
||||
ctx->tcp_topic_id = stellar_mq_get_topic_id(st, TOPIC_TCP);
|
||||
ctx->tcp_stream_topic_id = stellar_mq_get_topic_id(st, TOPIC_TCP_STREAM);
|
||||
|
||||
stellar_session_mq_subscribe(st, ctx->udp_topic_id, on_sess_udp_msg, ctx->sess_plug_id);
|
||||
stellar_session_mq_subscribe(st, ctx->tcp_topic_id, on_sess_tcp_msg, ctx->sess_plug_id);
|
||||
|
||||
Reference in New Issue
Block a user