Skip to content

Commit

Permalink
Fix the issues in the PR
Browse files Browse the repository at this point in the history
  • Loading branch information
matianxing1992 committed May 17, 2024
1 parent fe99a78 commit bf4d176
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/consumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,12 @@ Consumer::handleTimeout(const Interest& interest, int nRetrials,
{
if (nRetrials > 0) {
NDN_LOG_INFO("Timeout for: " << interest << ", retrying");
auto interestNew = const_cast<Interest&>(interest);
int factor = (int) std::pow(2, m_maxRetries+1-nRetrials);
interestNew.setInterestLifetime(ndn::time::milliseconds(m_defaultTimeout*factor));
interestNew.setNonce(std::nullopt);
m_face.expressInterest(interestNew, dataCallback,
Interest interestRetry(interest);
int factor = static_cast<int>(std::pow(2, m_maxRetries + 1 - nRetrials));
interestRetry.setCanBePrefix(true);
interestRetry.setInterestLifetime(ndn::time::milliseconds(m_defaultTimeout*factor));
interestRetry.setNonce(std::nullopt);
m_face.expressInterest(interestRetry, dataCallback,
std::bind(&Consumer::handleNack, this, _1, _2, errorCallback, nackMessage),
std::bind(&Consumer::handleTimeout, this, _1, nRetrials - 1,
dataCallback, errorCallback, nackMessage, timeoutMessage));
Expand Down

0 comments on commit bf4d176

Please sign in to comment.