Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ccn-lite-riot: remove message from queue on remove interest #359

Merged
merged 1 commit into from
Jun 17, 2019

Conversation

PeterKietzmann
Copy link
Collaborator

Contribution description

This PR removes any message that relates to an Interest from the RIOT message queue of the the CCN-lite thread, when removing this Interest (i.e., by ccnl_interest_remove()). This fixes a rare case that occurs when a retransmission message is queued and can't be processed before the pending Interest is satisfied, which will call ccnl_interest_remove(). Without this fix, the message will be processed at some point and reference an Interest that doesn't exist anymore.

@PeterKietzmann PeterKietzmann added bug riot all issues related to the riot adapter labels Jun 14, 2019
@@ -342,6 +342,15 @@ static inline void ccnl_riot_interest_remove(evtimer_t *et, struct ccnl_interest
{
evtimer_del(et, (evtimer_event_t *)&i->evtmsg_retrans);
evtimer_del(et, (evtimer_event_t *)&i->evtmsg_timeout);

/* remove messages that relate to this interest from the message queue */
thread_t *me = (thread_t*) sched_threads[sched_active_pid];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether we should disable interrupts while iterating the message queue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I've added that and amended to the first commit.

unsigned state = irq_disable();
/* remove messages that relate to this interest from the message queue */
thread_t *me = (thread_t*) sched_threads[sched_active_pid];
for (unsigned j = 0; j <= me->msg_queue.mask; j++) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On an iotlab-m3 node this takes around 4-7 us with a message queue length of 8.

Copy link
Collaborator

@cgundogan cgundogan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sensible. ACK!

@cgundogan cgundogan merged commit 00c7141 into cn-uofbasel:master Jun 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug riot all issues related to the riot adapter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants