-
Notifications
You must be signed in to change notification settings - Fork 63
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
Conversation
@@ -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]; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
22ef89e
to
bb66d55
Compare
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++) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sensible. ACK!
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 callccnl_interest_remove()
. Without this fix, the message will be processed at some point and reference an Interest that doesn't exist anymore.