mirror of
https://github.com/emqx/neuron.git
synced 2026-10-31 08:29:03 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2613fb805 | ||
|
|
2cf132fa92 | ||
|
|
fdc75007f5 | ||
|
|
bfa738f551 | ||
|
|
3ac6facd0f | ||
|
|
fd43c469ec | ||
|
|
f4a5414cad | ||
|
|
02b43d8484 | ||
|
|
8d9219ec47 | ||
|
|
299f64f68e | ||
|
|
d7b05d63fc | ||
|
|
ea1b279fd7 |
@@ -83,6 +83,7 @@ typedef enum {
|
||||
NEU_ERR_LICENSE_DISABLED = 2403,
|
||||
NEU_ERR_LICENSE_MAX_NODES = 2404,
|
||||
NEU_ERR_LICENSE_MAX_TAGS = 2405,
|
||||
NEU_ERR_LICENSE_BAD_CLOCK = 2407,
|
||||
|
||||
// common error codes for plugins
|
||||
NEU_ERR_PLUGIN_READ_FAILURE = 3000,
|
||||
|
||||
@@ -41,5 +41,6 @@ int neu_async_queue_pop(neu_async_queue_t *q, uint64_t key, void **elem);
|
||||
|
||||
void neu_async_queue_remove(neu_async_queue_t *q, neu_async_queue_filter filter,
|
||||
void *filter_elem);
|
||||
void neu_async_queue_clean(neu_async_queue_t *q);
|
||||
|
||||
#endif
|
||||
@@ -290,6 +290,12 @@ void neu_adapter_driver_write_tag(neu_adapter_driver_t *driver,
|
||||
free(tag);
|
||||
return;
|
||||
}
|
||||
if (tag->type == NEU_TYPE_FLOAT || tag->type == NEU_TYPE_DOUBLE) {
|
||||
if (cmd->value.type == NEU_TYPE_INT64) {
|
||||
cmd->value.value.d64 = (double) cmd->value.value.u64;
|
||||
}
|
||||
}
|
||||
|
||||
switch (tag->type) {
|
||||
case NEU_TYPE_BOOL:
|
||||
case NEU_TYPE_DOUBLE:
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "errcodes.h"
|
||||
#include "plugin.h"
|
||||
@@ -31,6 +32,7 @@ void neu_plugin_common_init(neu_plugin_common_t *common)
|
||||
common->magic = NEU_PLUGIN_MAGIC_NUMBER;
|
||||
common->link_state = NEU_NODE_LINK_STATE_DISCONNECTED;
|
||||
common->tag_size = 0;
|
||||
common->timestamp = time(NULL) * 1000; // don't need much precision at init
|
||||
}
|
||||
|
||||
bool neu_plugin_common_check(neu_plugin_t *plugin)
|
||||
|
||||
@@ -160,4 +160,18 @@ void neu_async_queue_remove(neu_async_queue_t *q, neu_async_queue_filter filter,
|
||||
}
|
||||
}
|
||||
nng_mtx_unlock(q->mtx);
|
||||
}
|
||||
|
||||
void neu_async_queue_clean(neu_async_queue_t *q)
|
||||
{
|
||||
element *el = NULL, *tmp = NULL;
|
||||
|
||||
nng_mtx_lock(q->mtx);
|
||||
DL_FOREACH_SAFE(q->list, el, tmp)
|
||||
{
|
||||
DL_DELETE(q->list, el);
|
||||
q->free_fn(el->data);
|
||||
free(el);
|
||||
}
|
||||
nng_mtx_unlock(q->mtx);
|
||||
}
|
||||
Reference in New Issue
Block a user