mirror of
https://github.com/emqx/neuron.git
synced 2026-10-29 23:19:18 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d1794ac24 | ||
|
|
67fcdaf693 | ||
|
|
50ccd73f67 | ||
|
|
021dfffa61 | ||
|
|
9bf0bba2ab | ||
|
|
e4d1aea07b | ||
|
|
e70417689d | ||
|
|
9bf3b580d7 | ||
|
|
0adb022042 | ||
|
|
b52e394fa1 | ||
|
|
90a1eae13f | ||
|
|
a64449bc8a | ||
|
|
a0ee5346f9 | ||
|
|
8d166fb159 | ||
|
|
191e69ec3e | ||
|
|
6af32bd9fc | ||
|
|
13becdd6af | ||
|
|
5c2ed5f1a3 | ||
|
|
a0bb29c100 |
@@ -8,8 +8,8 @@ on:
|
||||
- published
|
||||
|
||||
env:
|
||||
VERSION: 2.3.9
|
||||
UI_VERSION: 2.3.8
|
||||
VERSION: 2.3.13
|
||||
UI_VERSION: 2.3.9
|
||||
BRANCH: v2.3
|
||||
|
||||
jobs:
|
||||
@@ -96,7 +96,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: delete old daily-pre-release
|
||||
uses: dev-drprasad/delete-tag-and-release@v0.2.0
|
||||
uses: dev-drprasad/delete-tag-and-release@v0.2.1
|
||||
with:
|
||||
delete_release: true
|
||||
tag_name: ${{ env.BRANCH }}-daily
|
||||
@@ -258,4 +258,4 @@ jobs:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ./${{ steps.package.outputs.name}}
|
||||
asset_name: ${{ matrix.type }}-${{ env.VERSION }}-linux-${{ matrix.arch }}.${{ matrix.package }}
|
||||
asset_content_type: application/octet-stream
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
@@ -32,6 +32,10 @@ static void plugin_group_free(neu_plugin_group_t *pgp);
|
||||
|
||||
int file_group_timer(neu_plugin_t *plugin, neu_plugin_group_t *group)
|
||||
{
|
||||
neu_adapter_update_metric_cb_t update_metric =
|
||||
plugin->common.adapter_callbacks->update_metric;
|
||||
int64_t rtt = NEU_METRIC_LAST_RTT_MS_MAX;
|
||||
|
||||
struct file_group_data *gd = NULL;
|
||||
int length = plugin->file_length;
|
||||
|
||||
@@ -83,6 +87,8 @@ int file_group_timer(neu_plugin_t *plugin, neu_plugin_group_t *group)
|
||||
strncpy(dvalue.value.str, buf, strlen(buf));
|
||||
fclose(f);
|
||||
|
||||
rtt = 1;
|
||||
|
||||
dvalue_result:
|
||||
plugin->common.adapter_callbacks->driver.update(
|
||||
plugin->common.adapter, group->group_name, tag->name, dvalue);
|
||||
@@ -90,6 +96,8 @@ int file_group_timer(neu_plugin_t *plugin, neu_plugin_group_t *group)
|
||||
free(buf);
|
||||
}
|
||||
|
||||
update_metric(plugin->common.adapter, NEU_METRIC_LAST_RTT_MS, rtt, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,8 @@ void handle_logs_files(nng_aio *aio)
|
||||
return;
|
||||
}
|
||||
|
||||
rv = system("rm -rf /tmp/neuron_debug.tar.gz");
|
||||
nlog_warn("remove old neuron_debug.tar.gz, rv: %d", rv);
|
||||
/* tar the neuron directory */
|
||||
rv = system("tar -zcvf /tmp/neuron_debug.tar.gz ../neuron");
|
||||
if (rv == -1) {
|
||||
@@ -76,7 +78,7 @@ void handle_logs_files(nng_aio *aio)
|
||||
return;
|
||||
} else {
|
||||
if (WIFEXITED(rv)) {
|
||||
if (WEXITSTATUS(rv) != 0) {
|
||||
if (WEXITSTATUS(rv) < 0) {
|
||||
nlog_error("failed to create neuron_debug.tar.gz, rv: %d",
|
||||
WEXITSTATUS(rv));
|
||||
NEU_JSON_RESPONSE_ERROR(NEU_ERR_COMMAND_EXECUTION_FAILED, {
|
||||
|
||||
@@ -299,6 +299,8 @@ void neu_adapter_driver_write_tag(neu_adapter_driver_t *driver,
|
||||
(double) (cmd->value.value.d64 / tag->decimal);
|
||||
} else if (cmd->value.type == NEU_TYPE_DOUBLE) {
|
||||
cmd->value.value.d64 = cmd->value.value.d64 / tag->decimal;
|
||||
} else if (cmd->value.type == NEU_TYPE_FLOAT) {
|
||||
cmd->value.value.f32 = cmd->value.value.f32 / tag->decimal;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -357,8 +359,11 @@ void neu_adapter_driver_write_tag(neu_adapter_driver_t *driver,
|
||||
}
|
||||
break;
|
||||
case NEU_TYPE_FLOAT:
|
||||
cmd->value.type = NEU_TYPE_FLOAT;
|
||||
cmd->value.value.f32 = (float) cmd->value.value.d64;
|
||||
if (NEU_TYPE_FLOAT != cmd->value.type) {
|
||||
cmd->value.value.f32 = (float) cmd->value.value.d64;
|
||||
cmd->value.type = NEU_TYPE_FLOAT;
|
||||
}
|
||||
|
||||
switch (tag->option.value32.endian) {
|
||||
case NEU_DATATAG_ENDIAN_LB32:
|
||||
neu_ntohs_p((uint16_t *) cmd->value.value.bytes);
|
||||
|
||||
@@ -150,6 +150,7 @@ static void connect_cb(nng_pipe p, nng_pipe_ev ev, void *arg);
|
||||
|
||||
static inline task_t *client_alloc_task(neu_mqtt_client_t *client);
|
||||
static inline void client_free_task(neu_mqtt_client_t *client, task_t *task);
|
||||
static inline size_t client_task_free_list_len(neu_mqtt_client_t *client);
|
||||
static inline void client_add_subscription(neu_mqtt_client_t *client,
|
||||
subscription_t * sub);
|
||||
static int client_send_sub_msg(neu_mqtt_client_t *client,
|
||||
@@ -545,6 +546,16 @@ static inline void client_free_task(neu_mqtt_client_t *client, task_t *task)
|
||||
DL_PREPEND(client->task_free_list, task);
|
||||
}
|
||||
|
||||
static inline size_t client_task_free_list_len(neu_mqtt_client_t *client)
|
||||
{
|
||||
size_t count = 0;
|
||||
task_t *elt = NULL;
|
||||
// count by iterating the list,
|
||||
// this won't be a problem as a short free list is expected
|
||||
DL_COUNT(client->task_free_list, elt, count);
|
||||
return count;
|
||||
}
|
||||
|
||||
static inline void client_add_subscription(neu_mqtt_client_t *client,
|
||||
subscription_t * sub)
|
||||
{
|
||||
@@ -1149,6 +1160,12 @@ int neu_mqtt_client_close(neu_mqtt_client_t *client)
|
||||
}
|
||||
|
||||
nng_mtx_lock(client->mtx);
|
||||
// wait for all tasks
|
||||
while (client_task_free_list_len(client) != client->task_count) {
|
||||
nng_mtx_unlock(client->mtx);
|
||||
nng_msleep(100);
|
||||
nng_mtx_lock(client->mtx);
|
||||
}
|
||||
client->open = false;
|
||||
nng_mtx_unlock(client->mtx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user