проверки thread в ll_queue
This commit is contained in:
1 parent
1811764f6d
commit
5dfd1ea5fe
5 files changed
+85
-6
No files matched your search
@@ -88,7 +88,9 @@ int etcp_send(struct ETCP_CONN* conn, struct ll_entry* entry) {
|
||||
|
||||
// Помещаем entry в очередь input normalizer
|
||||
// queue_data_put забирает ownership entry
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_NORMALIZER, "Before put to input");
|
||||
int result = queue_data_put(pn->input, entry, 0);
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_NORMALIZER, "After put to input");
|
||||
|
||||
if (result != 0) {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_ETCP_API, "etcp_send: queue_data_put failed (queue full?)");
|
||||
|
||||
+11
-5
@@ -178,7 +178,7 @@ void pn_reset(struct PKTNORM* pn) {
|
||||
}
|
||||
}
|
||||
|
||||
// Send data to packer (copies and adds to input queue or pending, triggering callback)
|
||||
// Send data to packer (copies and adds to input queue or pending, triggering callback) используется только в юниттесте
|
||||
void pn_packer_send(struct PKTNORM* pn, uint8_t* data, uint16_t len) {
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_NORMALIZER, "");
|
||||
if (!pn || !data || len == 0) return;
|
||||
@@ -198,10 +198,13 @@ void pn_packer_send(struct PKTNORM* pn, uint8_t* data, uint16_t len) {
|
||||
pn->flush_timer = NULL;
|
||||
}
|
||||
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_NORMALIZER, "PUT to input");
|
||||
int ret = queue_data_put(pn->input, entry, 0);
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_NORMALIZER, "PUT to input end");
|
||||
// DEBUG_INFO(DEBUG_CATEGORY_NORMALIZER, "pn_packer_send: queue_data_put returned %d, input count=%d", ret, queue_entry_count(pn->input));
|
||||
}
|
||||
|
||||
|
||||
// Internal: Packer callback
|
||||
static void packer_cb(struct ll_queue* q, void* arg) {
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_NORMALIZER, "");
|
||||
@@ -263,14 +266,17 @@ static void pn_buf_renew(struct PKTNORM* pn) {
|
||||
|
||||
// Internal: Process input when etcp->input_queue is ready (empty)
|
||||
static void etcp_input_ready_cb(struct ll_queue* q, void* arg) {
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_NORMALIZER, "");
|
||||
struct PKTNORM* pn = (struct PKTNORM*)arg;
|
||||
if (!pn) return;
|
||||
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_NORMALIZER, "");
|
||||
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_NORMALIZER, "before get");
|
||||
struct ll_entry* in_dgram = queue_data_get(pn->input);
|
||||
if (!in_dgram) { queue_resume_callback(pn->input); return; }
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_NORMALIZER, "after get");
|
||||
if (!in_dgram) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_NORMALIZER, "Q EMPTY");
|
||||
queue_resume_callback(pn->input);
|
||||
return;
|
||||
}
|
||||
|
||||
if (debug_should_output(DEBUG_LEVEL_DEBUG, DEBUG_CATEGORY_DUMP)) log_dump("->NORM", in_dgram->dgram, in_dgram->len);
|
||||
|
||||
|
||||
@@ -58,6 +58,6 @@ void pn_reset(struct PKTNORM* pn);
|
||||
void pn_unpacker_reset_state(struct PKTNORM* pn);
|
||||
|
||||
// создаёт malloc data, копирует, помещает в input.
|
||||
void pn_packer_send(struct PKTNORM* pn, uint8_t* data, uint16_t len);
|
||||
//void pn_packer_send(struct PKTNORM* pn, uint8_t* data, uint16_t len);
|
||||
|
||||
#endif // PKT_NORMALIZER_H
|
||||
Reference in new issue
Block a user