make interest retransmit timeout configurable
This commit is contained in:
parent
79c79870e6
commit
dc727b43a7
@ -134,7 +134,13 @@ void ccnl_ll_TX(struct ccnl_relay_s *ccnl, struct ccnl_if_s *ifc,
|
||||
void ccnl_ageing(void *relay, void *aux)
|
||||
{
|
||||
ccnl_do_ageing(relay, aux);
|
||||
ccnl_set_timer(1000000, ccnl_ageing, relay, 0);
|
||||
ccnl_set_timer(CCNL_CHECK_TIMEOUT_USEC, ccnl_ageing, relay, 0);
|
||||
}
|
||||
|
||||
void ccnl_retransmit(void *relay, void *aux)
|
||||
{
|
||||
ccnl_do_retransmit(relay, aux);
|
||||
ccnl_set_timer(CCNL_CHECK_RETRANSMIT_USEC, ccnl_retransmit, relay, 0);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@ -204,7 +210,8 @@ void ccnl_relay_config(struct ccnl_relay_s *relay, int max_cache_entries, int fi
|
||||
f->flags |= CCNL_FACE_FLAGS_STATIC;
|
||||
i->broadcast_face = f;
|
||||
|
||||
ccnl_set_timer(1000000, ccnl_ageing, relay, 0);
|
||||
ccnl_set_timer(CCNL_CHECK_TIMEOUT_USEC, ccnl_ageing, relay, 0);
|
||||
ccnl_set_timer(CCNL_CHECK_RETRANSMIT_USEC, ccnl_retransmit, relay, 0);
|
||||
}
|
||||
|
||||
#if RIOT_CCNL_POPULATE
|
||||
@ -326,7 +333,7 @@ int ccnl_io_loop(struct ccnl_relay_s *ccnl)
|
||||
radio_packet_t *p;
|
||||
riot_ccnl_msg_t *m;
|
||||
struct timeval *timeout;
|
||||
unsigned long us = 100 * 1000;
|
||||
unsigned long us = CCNL_CHECK_RETRANSMIT_USEC;
|
||||
int hwtimer_id;
|
||||
|
||||
while (!ccnl->halt_flag) {
|
||||
|
||||
@ -738,7 +738,6 @@ ccnl_interest_new(struct ccnl_relay_s *ccnl, struct ccnl_face_s *from,
|
||||
*ppkd = 0;
|
||||
i->minsuffix = minsuffix;
|
||||
i->maxsuffix = maxsuffix;
|
||||
ccnl_get_timeval(&i->last_used);
|
||||
DBL_LINKED_LIST_ADD(ccnl->pit, i);
|
||||
return i;
|
||||
}
|
||||
@ -1097,12 +1096,12 @@ ccnl_forward_remove(struct ccnl_relay_s *ccnl, struct ccnl_forward_s *fwd)
|
||||
fwd2 = fwd->next;
|
||||
DBL_LINKED_LIST_REMOVE(ccnl->fib, fwd);
|
||||
|
||||
struct ccnl_interest_s *pit;
|
||||
for (pit = ccnl->pit; pit;) {
|
||||
if (pit->forwarded_over == fwd) {
|
||||
pit->forwarded_over = NULL;
|
||||
for (struct ccnl_interest_s *p = ccnl->pit; p; p = p->next) {
|
||||
if (p->forwarded_over == fwd) {
|
||||
p->forwarded_over = NULL;
|
||||
}
|
||||
}
|
||||
DEBUGMSG(40, " ccnl_forward_remove next=%p\n", (void *) fwd2);
|
||||
|
||||
free_forward(fwd);
|
||||
return fwd2;
|
||||
@ -1114,6 +1113,39 @@ bool ccnl_is_timeouted(struct timeval *now, struct timeval *last_used, time_t ti
|
||||
return timevaldelta(now, &abs_timeout) > 0;
|
||||
}
|
||||
|
||||
void ccnl_do_retransmit(void *ptr, void *dummy)
|
||||
{
|
||||
(void) dummy; /* unused */
|
||||
|
||||
struct ccnl_relay_s *relay = (struct ccnl_relay_s *) ptr;
|
||||
struct ccnl_interest_s *i = relay->pit;
|
||||
|
||||
while (i) { // CONFORM: "Entries in the PIT MUST timeout rather
|
||||
// than being held indefinitely."
|
||||
if (i->retries > CCNL_MAX_INTEREST_RETRANSMIT) {
|
||||
i = ccnl_interest_remove(relay, i);
|
||||
}
|
||||
else {
|
||||
// CONFORM: "A node MUST retransmit Interest Messages
|
||||
// periodically for pending PIT entries."
|
||||
DEBUGMSG(7, " retransmit %d <%s>\n", i->retries,
|
||||
ccnl_prefix_to_path(i->prefix));
|
||||
|
||||
if (i->forwarded_over
|
||||
&& !(i->forwarded_over->flags & CCNL_FORWARD_FLAGS_STATIC)
|
||||
&& (i->retries >= CCNL_MAX_INTEREST_OPTIMISTIC)) {
|
||||
DEBUGMSG(1, " removed dynamic forward %p\n", (void *) i->forwarded_over);
|
||||
ccnl_forward_remove(relay, i->forwarded_over);
|
||||
}
|
||||
|
||||
i->retries++;
|
||||
ccnl_interest_propagate(relay, i);
|
||||
|
||||
i = i->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ccnl_do_ageing(void *ptr, void *dummy)
|
||||
{
|
||||
|
||||
@ -1121,7 +1153,7 @@ void ccnl_do_ageing(void *ptr, void *dummy)
|
||||
|
||||
struct ccnl_relay_s *relay = (struct ccnl_relay_s *) ptr;
|
||||
struct ccnl_content_s *c = relay->contents;
|
||||
struct ccnl_interest_s *i = relay->pit;
|
||||
|
||||
struct ccnl_face_s *f = relay->faces;
|
||||
struct timeval now;
|
||||
ccnl_get_timeval(&now);
|
||||
@ -1137,29 +1169,6 @@ void ccnl_do_ageing(void *ptr, void *dummy)
|
||||
}
|
||||
}
|
||||
|
||||
while (i) { // CONFORM: "Entries in the PIT MUST timeout rather
|
||||
// than being held indefinitely."
|
||||
if (ccnl_is_timeouted(&now, &i->last_used, CCNL_INTEREST_TIMEOUT_SEC, CCNL_INTEREST_TIMEOUT_SEC) ||
|
||||
i->retries > CCNL_MAX_INTEREST_RETRANSMIT) {
|
||||
i = ccnl_interest_remove(relay, i);
|
||||
}
|
||||
else {
|
||||
// CONFORM: "A node MUST retransmit Interest Messages
|
||||
// periodically for pending PIT entries."
|
||||
DEBUGMSG(7, " retransmit %d <%s>\n", i->retries,
|
||||
ccnl_prefix_to_path(i->prefix));
|
||||
|
||||
if (i->forwarded_over && !(i->forwarded_over->flags & CCNL_FORWARD_FLAGS_STATIC)) {
|
||||
ccnl_forward_remove(relay, i->forwarded_over);
|
||||
}
|
||||
|
||||
i->retries++;
|
||||
ccnl_interest_propagate(relay, i);
|
||||
|
||||
i = i->next;
|
||||
}
|
||||
}
|
||||
|
||||
while (f) {
|
||||
if (!(f->flags & CCNL_FACE_FLAGS_STATIC)
|
||||
&& ccnl_is_timeouted(&now, &f->last_used, CCNL_FACE_TIMEOUT_SEC, CCNL_FACE_TIMEOUT_USEC)) {
|
||||
|
||||
@ -170,7 +170,6 @@ struct ccnl_interest_s {
|
||||
int minsuffix, maxsuffix;
|
||||
struct ccnl_buf_s *ppkd; // publisher public key digest
|
||||
struct ccnl_buf_s *pkt; // full datagram
|
||||
struct timeval last_used;
|
||||
int retries;
|
||||
struct ccnl_forward_s *forwarded_over;
|
||||
};
|
||||
@ -255,6 +254,7 @@ ccnl_extract_prefix_nonce_ppkd(unsigned char **data, int *datalen, int *scope,
|
||||
struct ccnl_buf_s **nonce, struct ccnl_buf_s **ppkd,
|
||||
unsigned char **content, int *contlen);
|
||||
|
||||
void ccnl_do_retransmit(void *ptr, void *dummy);
|
||||
void ccnl_do_ageing(void *ptr, void *dummy);
|
||||
|
||||
void ccnl_interface_CTS(void *aux1, void *aux2);
|
||||
|
||||
@ -26,10 +26,8 @@
|
||||
#define CCNL_CONTENT_TIMEOUT_SEC 2
|
||||
#define CCNL_CONTENT_TIMEOUT_USEC 0
|
||||
|
||||
#define CCNL_INTEREST_TIMEOUT_SEC 2
|
||||
#define CCNL_INTEREST_TIMEOUT_USEC 2
|
||||
|
||||
#define CCNL_MAX_INTEREST_RETRANSMIT 4
|
||||
#define CCNL_MAX_INTEREST_RETRANSMIT 5
|
||||
#define CCNL_MAX_INTEREST_OPTIMISTIC 2
|
||||
|
||||
#define CCNL_FACE_TIMEOUT_SEC 10
|
||||
#define CCNL_FACE_TIMEOUT_USEC 0
|
||||
@ -37,6 +35,9 @@
|
||||
#define CCNL_FWD_TIMEOUT_SEC 10
|
||||
#define CCNL_FWD_TIMEOUT_USEC 0
|
||||
|
||||
#define CCNL_CHECK_TIMEOUT_USEC (1 * 1000 * 1000)
|
||||
#define CCNL_CHECK_RETRANSMIT_USEC ( 100 * 1000)
|
||||
|
||||
#define CCNL_MAX_NAME_COMP 16
|
||||
#define CCNL_MAX_IF_QLEN 64
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user