Skip to content

Commit

Permalink
Adapatation layer unicast list entry free update
Browse files Browse the repository at this point in the history
Added new parameter for reject fragmented buffer unnesessary free.

Change-Id: Ifa5bd09ea7759aa4fb942d59d7d5d273e85ff4e9
  • Loading branch information
Juha Heiskanen committed Dec 19, 2019
1 parent 4481e86 commit 0494606
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions source/6LoWPAN/adaptation_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,14 @@ static void lowpan_list_entry_free(fragmenter_tx_list_t *list, fragmenter_tx_ent
ns_dyn_mem_free(entry);
}

static void lowpan_list_free(fragmenter_tx_list_t *list)
static void lowpan_list_free(fragmenter_tx_list_t *list, bool fragment_buf_free)
{
while (!ns_list_is_empty(list)) {
fragmenter_tx_entry_t *entry = ns_list_get_first(list);
if (!fragment_buf_free) {
//We can't free this pointer becuase it must be until interface is deleted
entry->fragmenter_buf = NULL;
}
lowpan_list_entry_free(list, entry);
}
}
Expand Down Expand Up @@ -388,11 +392,11 @@ int8_t lowpan_adaptation_interface_free(int8_t interface_id)

ns_list_remove(&fragmenter_interface_list, interface_ptr);
//free active tx process
lowpan_list_free(&interface_ptr->activeUnicastList);
lowpan_list_free(&interface_ptr->activeUnicastList, false);
lowpan_active_buffer_state_reset(&interface_ptr->active_broadcast_tx_buf);

//Free Indirect entry
lowpan_list_free(&interface_ptr->indirect_tx_queue);
lowpan_list_free(&interface_ptr->indirect_tx_queue, true);

buffer_free_list(&interface_ptr->directTxQueue);

Expand All @@ -413,13 +417,13 @@ int8_t lowpan_adaptation_interface_reset(int8_t interface_id)
}

//free active tx process
lowpan_list_free(&interface_ptr->activeUnicastList);
lowpan_list_free(&interface_ptr->activeUnicastList, false);
lowpan_active_buffer_state_reset(&interface_ptr->active_broadcast_tx_buf);
//Clean fragmented message flag
interface_ptr->fragmenter_active = false;

//Free Indirect entry
lowpan_list_free(&interface_ptr->indirect_tx_queue);
lowpan_list_free(&interface_ptr->indirect_tx_queue, true);

buffer_free_list(&interface_ptr->directTxQueue);

Expand Down

0 comments on commit 0494606

Please sign in to comment.