Merge pull request #2689 from fengzeroz/main

fix crash & import tags
This commit is contained in:
fengzeroz
2026-02-03 14:04:00 +08:00
committed by GitHub
3 changed files with 9 additions and 5 deletions
+2
View File
@@ -167,6 +167,7 @@ int mqtt_plugin_uninit(neu_plugin_t *plugin)
mqtt_config_fini(&plugin->config);
if (plugin->client) {
neu_mqtt_client_remove_cache_db(plugin->client);
neu_mqtt_client_close(plugin->client);
neu_mqtt_client_free(plugin->client);
plugin->client = NULL;
@@ -395,6 +396,7 @@ int mqtt_plugin_config(neu_plugin_t *plugin, const char *setting)
}
if (plugin->client != NULL) {
neu_mqtt_client_remove_cache_db(plugin->client);
neu_mqtt_client_close(plugin->client);
neu_mqtt_client_free(plugin->client);
}
+5 -4
View File
@@ -733,7 +733,6 @@ static void put_apps_context_next(context_t *ctx, neu_reqresp_type_e type,
for (; ctx->idx < (size_t) apps->n_app; ++ctx->idx) {
neu_json_app_t *app = &apps->apps[ctx->idx];
if (is_default_app_node(app->node.name, app->node.plugin)) {
NEXT(ctx, add_app_tags, app);
if (NULL == app->node.setting) {
continue;
}
@@ -764,6 +763,7 @@ static void put_apps_context_next(context_t *ctx, neu_reqresp_type_e type,
for (; ctx->idx < (size_t) apps->n_app; ++ctx->idx) {
neu_json_app_t *app = &apps->apps[ctx->idx];
NEXT(ctx, add_app_tags, app);
++ctx->idx;
goto done;
}
@@ -1798,10 +1798,11 @@ static int add_app_node(context_t *ctx, neu_json_app_t *app)
neu_req_add_node_t cmd = { 0 };
strcpy(cmd.node, app->node.name);
strcpy(cmd.plugin, app->node.plugin);
cmd.setting = app->node.setting;
cmd.tags = app->node.tags;
cmd.setting = app->node.setting;
if (app->node.tags != NULL) {
cmd.tags = strdup(app->node.tags);
}
app->node.setting = NULL;
app->node.tags = NULL;
if (0 != neu_plugin_op(plugin, header, &cmd)) {
return NEU_ERR_IS_BUSY;
+2 -1
View File
@@ -751,6 +751,7 @@ static void conn_tcp_server_listen(neu_conn_t *conn)
};
fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, IPPROTO_TCP);
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &(int) { 1 }, sizeof(int));
ret = bind(fd, (struct sockaddr *) &local, sizeof(local));
} else if (is_ipv6(conn->param.params.tcp_server.ip)) {
@@ -761,7 +762,7 @@ static void conn_tcp_server_listen(neu_conn_t *conn)
&local.sin6_addr);
fd = socket(AF_INET6, SOCK_STREAM | SOCK_NONBLOCK, IPPROTO_TCP);
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &(int) { 1 }, sizeof(int));
ret = bind(fd, (struct sockaddr *) &local, sizeof(local));
} else {
zlog_error(conn->param.log, "invalid ip: %s",