Skip to content

Commit

Permalink
Merge pull request #383 from MahdiBaghbani/fix-ndntlv-interestlifetime
Browse files Browse the repository at this point in the history
fix #382 and #210: NDN protocol interest lifetime
  • Loading branch information
blacksheeep authored Mar 28, 2021
2 parents f125b9f + 78079f4 commit da0d9de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/ccnl-core/src/ccnl-interest.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ ccnl_interest_new(struct ccnl_relay_s *ccnl, struct ccnl_face_s *from,
i->from = from;
i->last_used = CCNL_NOW();

/** default value for max_pit_entries is defined in ccn-iribu-defs.h as
* CCNL_DEFAULT_MAX_PIT_ENTRIES
* it is set to -1 (means infinity) for anything other than arduino, riot or android
* this code checks if max_pit_entries isn't defaulted to -1 and then compares its
* value against the pitcnt value */
if ((ccnl->max_pit_entries != -1) && (ccnl->pitcnt >= ccnl->max_pit_entries)) {
ccnl_pkt_free(i->pkt);
ccnl_free(i);
Expand Down
2 changes: 1 addition & 1 deletion src/ccnl-pkt/src/ccnl-pkt-ndntlv.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ ccnl_ndntlv_bytes2pkt(uint64_t pkttype, uint8_t *start,
pkt->s.ndntlv.maxsuffix = CCNL_MAX_NAME_COMP;

/* set default lifetime, in case InterestLifetime guider is absent */
pkt->s.ndntlv.interestlifetime = CCNL_INTEREST_TIMEOUT;
pkt->s.ndntlv.interestlifetime = CCNL_INTEREST_TIMEOUT * 1000; // ms

oldpos = *data - start;
while (ccnl_ndntlv_dehead(data, datalen, &typ, &len) == 0) {
Expand Down

0 comments on commit da0d9de

Please sign in to comment.