mirror of
https://github.com/emqx/neuron.git
synced 2026-10-26 03:40:01 +08:00
@@ -78,6 +78,8 @@ jobs:
|
||||
with:
|
||||
gcov: true
|
||||
fail_ci_if_error: true
|
||||
gcov_include: include plugins src
|
||||
gcov_ignore: tests simulator
|
||||
|
||||
ft:
|
||||
runs-on: ubuntu-20.04
|
||||
@@ -116,6 +118,8 @@ jobs:
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
gcov: true
|
||||
gcov_include: include plugins src
|
||||
gcov_ignore: tests simulator
|
||||
|
||||
pyft:
|
||||
runs-on: ubuntu-20.04
|
||||
@@ -170,4 +174,6 @@ jobs:
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
gcov: true
|
||||
gcov_include: include plugins src
|
||||
gcov_ignore: tests simulator
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ file perms = 666
|
||||
|
||||
[formats]
|
||||
|
||||
stdout_format = "%d [%V] [%c] %f:%L %m%n"
|
||||
file_format = "%d [%V] %f:%L %m%n"
|
||||
stdout_format = "%d:%ms [%V] [%c] %f:%L %m%n"
|
||||
file_format = "%d:%ms [%V] %f:%L %m%n"
|
||||
|
||||
[rules]
|
||||
|
||||
|
||||
@@ -79,6 +79,10 @@ void handle_write(nng_aio *aio)
|
||||
return;
|
||||
}
|
||||
|
||||
nng_http_req *nng_req = nng_aio_get_input(aio, 0);
|
||||
nlog_notice("<%p> req %s %s", aio, nng_http_req_get_method(nng_req),
|
||||
nng_http_req_get_uri(nng_req));
|
||||
|
||||
header.ctx = aio;
|
||||
header.type = NEU_REQ_WRITE_TAG;
|
||||
|
||||
@@ -144,6 +148,9 @@ void handle_write_tags(nng_aio *aio)
|
||||
}
|
||||
}
|
||||
|
||||
nng_http_req *nng_req = nng_aio_get_input(aio, 0);
|
||||
nlog_notice("<%p> req %s %s", aio, nng_http_req_get_method(nng_req),
|
||||
nng_http_req_get_uri(nng_req));
|
||||
header.ctx = aio;
|
||||
header.type = NEU_REQ_WRITE_TAGS;
|
||||
|
||||
|
||||
+39
-10
@@ -104,6 +104,8 @@ static void write_response(neu_adapter_t *adapter, void *r, neu_error error)
|
||||
|
||||
req->type = NEU_RESP_ERROR;
|
||||
|
||||
nlog_notice("write tag response <%p>", req->ctx);
|
||||
|
||||
adapter->cb_funs.response(adapter, req, &nerror);
|
||||
free(req);
|
||||
}
|
||||
@@ -311,12 +313,20 @@ void neu_adapter_driver_start_group_timer(neu_adapter_driver_t *driver)
|
||||
.type = NEU_EVENT_TIMER_NOBLOCK,
|
||||
};
|
||||
|
||||
param.cb = report_callback;
|
||||
el->report = neu_adapter_add_timer((neu_adapter_t *) driver, param);
|
||||
|
||||
param.type = driver->adapter.module->timer_type;
|
||||
param.cb = read_callback;
|
||||
el->read = neu_event_add_timer(driver->driver_events, param);
|
||||
|
||||
struct timespec t1 = {
|
||||
.tv_sec = 0,
|
||||
.tv_nsec = 1000 * 1000 * 20,
|
||||
};
|
||||
struct timespec t2 = { 0 };
|
||||
nanosleep(&t1, &t2);
|
||||
|
||||
param.type = NEU_EVENT_TIMER_NOBLOCK;
|
||||
param.cb = report_callback;
|
||||
el->report = neu_adapter_add_timer((neu_adapter_t *) driver, param);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -700,14 +710,23 @@ int neu_adapter_driver_add_group(neu_adapter_driver_t *driver, const char *name,
|
||||
neu_group_split_static_tags(find->group, &find->static_tags,
|
||||
&find->grp.tags);
|
||||
|
||||
param.type = driver->adapter.module->timer_type;
|
||||
param.cb = read_callback;
|
||||
find->read = neu_event_add_timer(driver->driver_events, param);
|
||||
|
||||
struct timespec t1 = {
|
||||
.tv_sec = 0,
|
||||
.tv_nsec = 1000 * 1000 * 20,
|
||||
};
|
||||
struct timespec t2 = { 0 };
|
||||
nanosleep(&t1, &t2);
|
||||
|
||||
param.type = NEU_EVENT_TIMER_NOBLOCK;
|
||||
param.cb = report_callback;
|
||||
find->report = neu_adapter_add_timer((neu_adapter_t *) driver, param);
|
||||
param.type = driver->adapter.module->timer_type;
|
||||
param.cb = read_callback;
|
||||
find->read = neu_event_add_timer(driver->driver_events, param);
|
||||
|
||||
param.second = 0;
|
||||
param.millisecond = 100;
|
||||
param.millisecond = 3;
|
||||
param.cb = write_callback;
|
||||
find->write = neu_event_add_timer(driver->driver_events, param);
|
||||
|
||||
@@ -796,11 +815,21 @@ int neu_adapter_driver_update_group(neu_adapter_driver_t *driver,
|
||||
neu_group_set_interval(find->group, interval);
|
||||
|
||||
// restore the timers
|
||||
|
||||
param.type = driver->adapter.module->timer_type;
|
||||
param.cb = read_callback;
|
||||
find->read = neu_event_add_timer(driver->driver_events, param);
|
||||
|
||||
struct timespec t1 = {
|
||||
.tv_sec = 0,
|
||||
.tv_nsec = 1000 * 1000 * 20,
|
||||
};
|
||||
struct timespec t2 = { 0 };
|
||||
nanosleep(&t1, &t2);
|
||||
|
||||
param.type = NEU_EVENT_TIMER_NOBLOCK;
|
||||
param.cb = report_callback;
|
||||
find->report = neu_adapter_add_timer((neu_adapter_t *) driver, param);
|
||||
param.type = driver->adapter.module->timer_type;
|
||||
param.cb = read_callback;
|
||||
find->read = neu_event_add_timer(driver->driver_events, param);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ static int response(nng_aio *aio, char *content, enum nng_http_status status)
|
||||
nng_http_res_set_status(res, status);
|
||||
|
||||
nng_http_req *nng_req = nng_aio_get_input(aio, 0);
|
||||
nlog_notice("%s %s [%d]", nng_http_req_get_method(nng_req),
|
||||
nlog_notice("<%p> %s %s [%d]", aio, nng_http_req_get_method(nng_req),
|
||||
nng_http_req_get_uri(nng_req), status);
|
||||
|
||||
nng_aio_set_output(aio, 0, res);
|
||||
|
||||
Reference in New Issue
Block a user