clean up ccnls main loop

This commit is contained in:
Christian Mehlis 2013-12-16 22:52:20 +01:00
parent 72eec00f62
commit 429b97c45b

View File

@ -330,8 +330,6 @@ int ccnl_io_loop(struct ccnl_relay_s *ccnl)
int hwtimer_id; int hwtimer_id;
while (!ccnl->halt_flag) { while (!ccnl->halt_flag) {
//DEBUGMSG(1, "waiting for incomming msg\n");
hwtimer_id = hwtimer_set(HWTIMER_TICKS(us), ccnl_timeout_callback, ccnl); hwtimer_id = hwtimer_set(HWTIMER_TICKS(us), ccnl_timeout_callback, ccnl);
if (hwtimer_id == -1) { if (hwtimer_id == -1) {
puts("NO MORE TIMERS!"); puts("NO MORE TIMERS!");
@ -339,12 +337,12 @@ int ccnl_io_loop(struct ccnl_relay_s *ccnl)
//DEBUGMSG(1, "hwtimer_id is %d\n", hwtimer_id); //DEBUGMSG(1, "hwtimer_id is %d\n", hwtimer_id);
} }
msg_receive(&in); msg_receive(&in);
//DEBUGMSG(1, "%s Packet waiting, us was %lu\n", riot_ccnl_event_to_string(in.type), us);
switch (in.type) { switch (in.type) {
case PKT_PENDING: case PKT_PENDING:
hwtimer_remove(hwtimer_id); hwtimer_remove(hwtimer_id);
p = (radio_packet_t *) in.content.ptr; p = (radio_packet_t *) in.content.ptr;
DEBUGMSG(1, "%s Packet waiting\n", riot_ccnl_event_to_string(in.type));
DEBUGMSG(1, "\tLength:\t%u\n", p->length); DEBUGMSG(1, "\tLength:\t%u\n", p->length);
DEBUGMSG(1, "\tSrc:\t%u\n", p->src); DEBUGMSG(1, "\tSrc:\t%u\n", p->src);
DEBUGMSG(1, "\tDst:\t%u\n", p->dst); DEBUGMSG(1, "\tDst:\t%u\n", p->dst);
@ -361,7 +359,6 @@ int ccnl_io_loop(struct ccnl_relay_s *ccnl)
case (CCNL_RIOT_MSG): case (CCNL_RIOT_MSG):
hwtimer_remove(hwtimer_id); hwtimer_remove(hwtimer_id);
m = (riot_ccnl_msg_t *) in.content.ptr; m = (riot_ccnl_msg_t *) in.content.ptr;
DEBUGMSG(1, "%s Packet waiting\n", riot_ccnl_event_to_string(in.type));
DEBUGMSG(1, "\tLength:\t%u\n", m->size); DEBUGMSG(1, "\tLength:\t%u\n", m->size);
DEBUGMSG(1, "\tSrc:\t%u\n", in.sender_pid); DEBUGMSG(1, "\tSrc:\t%u\n", in.sender_pid);
@ -371,16 +368,15 @@ int ccnl_io_loop(struct ccnl_relay_s *ccnl)
case (CCNL_RIOT_HALT): case (CCNL_RIOT_HALT):
hwtimer_remove(hwtimer_id); hwtimer_remove(hwtimer_id);
DEBUGMSG(1, "%s Packet waiting\n", riot_ccnl_event_to_string(in.type));
DEBUGMSG(1, "\tSrc:\t%u\n", in.sender_pid); DEBUGMSG(1, "\tSrc:\t%u\n", in.sender_pid);
DEBUGMSG(1, "\tNumb:\t%" PRIu32 "\n", in.content.value); DEBUGMSG(1, "\tNumb:\t%" PRIu32 "\n", in.content.value);
ccnl->halt_flag = 1; ccnl->halt_flag = 1;
break; break;
#if RIOT_CCNL_POPULATE #if RIOT_CCNL_POPULATE
case (CCNL_RIOT_POPULATE): case (CCNL_RIOT_POPULATE):
hwtimer_remove(hwtimer_id); hwtimer_remove(hwtimer_id);
DEBUGMSG(1, "%s Packet waiting\n", riot_ccnl_event_to_string(in.type));
DEBUGMSG(1, "\tSrc:\t%u\n", in.sender_pid); DEBUGMSG(1, "\tSrc:\t%u\n", in.sender_pid);
DEBUGMSG(1, "\tNumb:\t%" PRIu32 "\n", in.content.value); DEBUGMSG(1, "\tNumb:\t%" PRIu32 "\n", in.content.value);