1
This commit is contained in:
1 parent
4352041416
commit
d06bfffc68
3 files changed
+12
No files matched your search
@@ -283,6 +283,8 @@ void etcp_conn_reset(struct ETCP_CONN* etcp) {
|
||||
etcp->retrans_timer = NULL;
|
||||
etcp->ack_resp_timer = NULL;
|
||||
|
||||
etcp->reset_count++;
|
||||
|
||||
// Reset normalizer (packer/unpacker state for reconnection)
|
||||
if (etcp->normalizer) {
|
||||
pn_reset(etcp->normalizer);
|
||||
@@ -295,6 +297,8 @@ void etcp_conn_reinit(struct ETCP_CONN* etcp) {
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "");
|
||||
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "Reinitializing ETCP connection [%s]", etcp->log_name);
|
||||
|
||||
etcp->reinit_count++;
|
||||
|
||||
// Сбрасываем initialized во всех линках
|
||||
struct ETCP_LINK* link = etcp->links;
|
||||
while (link) {
|
||||
|
||||
@@ -115,6 +115,8 @@ struct ETCP_CONN {
|
||||
uint32_t bytes_sent_total;
|
||||
// uint32_t bytes_received_total; // Not used
|
||||
uint32_t retransmissions_count;
|
||||
uint32_t reinit_count;
|
||||
uint32_t reset_count;
|
||||
// uint32_t bytes_sent_norx; // сколько отправили байт без единого ответного пакета (для детекции запроса реконнекта)
|
||||
|
||||
// Window and inflight management
|
||||
|
||||
@@ -30,6 +30,7 @@ struct PKTNORM* pn_init(struct ETCP_CONN* etcp) {
|
||||
|
||||
struct PKTNORM* pn = u_calloc(1, sizeof(struct PKTNORM));
|
||||
if (!pn) {
|
||||
pn->alloc_errors++;
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_NORMALIZER, "pn_init: calloc failed");
|
||||
return NULL;
|
||||
}
|
||||
@@ -185,6 +186,7 @@ void pn_packer_send(struct PKTNORM* pn, uint8_t* data, uint16_t len) {
|
||||
|
||||
struct ll_entry* entry = ll_alloc_lldgram(len);
|
||||
if (!entry) {
|
||||
pn->alloc_errors++;
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_NORMALIZER, "pn_packer_send: ll_alloc_lldgram failed");
|
||||
return;
|
||||
}
|
||||
@@ -253,6 +255,7 @@ static void pn_buf_renew(struct PKTNORM* pn) {
|
||||
if (!pn->data) {
|
||||
pn->data = memory_pool_alloc(pn->etcp->instance->data_pool);
|
||||
if (!pn->data) {
|
||||
pn->alloc_errors++;
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_NORMALIZER, "pn_buf_renew: memory_pool_alloc failed");
|
||||
return;
|
||||
}
|
||||
@@ -349,6 +352,7 @@ static void pn_unpacker_cb(struct ll_queue* q, void* arg) {
|
||||
if (!pn->recvpart) {
|
||||
// Need length header for new packet
|
||||
if (len - ptr < 2) {
|
||||
pn->logic_errors++;
|
||||
// Incomplete header, reset
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_NORMALIZER, "reset state");
|
||||
// pn_unpacker_reset_state(pn);
|
||||
@@ -360,6 +364,7 @@ static void pn_unpacker_cb(struct ll_queue* q, void* arg) {
|
||||
ptr += 2;
|
||||
|
||||
if (part_size<1 || part_size>16384) {
|
||||
pn->logic_errors++;
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_NORMALIZER, "PART_SIZE ERROR!!! %d", part_size);
|
||||
etcp_conn_reinit(pn->etcp);
|
||||
break;
|
||||
@@ -367,6 +372,7 @@ static void pn_unpacker_cb(struct ll_queue* q, void* arg) {
|
||||
|
||||
pn->recvpart = ll_alloc_lldgram(part_size);
|
||||
if (!pn->recvpart) {
|
||||
pn->alloc_errors++;
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_NORMALIZER, "ll_alloc_lldgram failed");
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user