void
RequestAutoRetry::sendInterest()
{
  m_interest.refreshNonce();
  BOOST_ASSERT(m_interest.hasNonce());

  ++m_nSent;
  m_face.request(m_interest,
                 bind(&RequestAutoRetry::handleData, this, _2),
                 bind(&RequestAutoRetry::handleNack, this, _2),
                 bind(&RequestAutoRetry::handleTimeout, this),
                 m_retxInterval);
}
示例#2
0
void
Validator::onTimeout(const Interest& interest,
                     int remainingRetries,
                     const OnFailure& onFailure,
                     const shared_ptr<ValidationRequest>& validationRequest)
{
  if (remainingRetries > 0) {
    Interest newInterest = Interest(interest);
    newInterest.refreshNonce();

    // Express the same interest with different nonce and decremented remainingRetries.
    m_face->expressInterest(newInterest,
                            bind(&Validator::onData, this, _1, _2, validationRequest),
                            bind(&Validator::onNack, this, _1, _2,
                                 remainingRetries - 1, onFailure, validationRequest),
                            bind(&Validator::onTimeout, this, _1,
                                 remainingRetries - 1, onFailure, validationRequest));
  }
  else {
    onFailure("Cannot fetch cert: " + interest.getName().toUri());
  }
}