Merge pull request #4440 from OlegHahm/ccnl_first_fixes

CCN-Lite: first fixes
This commit is contained in:
Cenk Gündoğan 2015-12-10 08:04:28 +01:00
commit 6e332dc0b5

View File

@ -159,9 +159,6 @@ int _ccnl_interest(int argc, char **argv)
return -1;
}
/* XXX: https://xkcd.com/221/ */
genrand_init(0x4);
/* initialize address with 0xFF for broadcast */
size_t addr_len = MAX_ADDR_LEN;
uint8_t relay_addr[MAX_ADDR_LEN];
@ -170,10 +167,16 @@ int _ccnl_interest(int argc, char **argv)
addr_len = gnrc_netif_addr_from_str(relay_addr, sizeof(relay_addr), argv[2]);
}
memset(_int_buf, '\0', BUF_SIZE);
memset(_cont_buf, '\0', BUF_SIZE);
for (int cnt = 0; cnt < CCNL_INTEREST_RETRIES; cnt++) {
ccnl_send_interest(CCNL_SUITE_NDNTLV, argv[1], relay_addr, addr_len, NULL, _int_buf, BUF_SIZE);
ccnl_wait_for_chunk(_cont_buf, BUF_SIZE);
if (ccnl_wait_for_chunk(_cont_buf, BUF_SIZE) > 0) {
printf("Content received: %s\n", _cont_buf);
return 0;
}
}
printf("Timeout! No content received in response to the Interest for %s.\n", argv[1]);
return 0;
return -1;
}