This source file includes following definitions.
- delay_verifications_
- VerifyNonceIsValidAndUnique
- PendingVerifications
- RunPendingVerifications
#include "net/quic/test_tools/delayed_verify_strike_register_client.h"
using base::StringPiece;
using std::string;
using std::vector;
namespace net {
namespace test {
DelayedVerifyStrikeRegisterClient::DelayedVerifyStrikeRegisterClient(
unsigned max_entries,
uint32 current_time_external,
uint32 window_secs,
const uint8 orbit[8],
StrikeRegister::StartupType startup)
: LocalStrikeRegisterClient(max_entries, current_time_external,
window_secs, orbit, startup),
delay_verifications_(false) {
}
DelayedVerifyStrikeRegisterClient::~DelayedVerifyStrikeRegisterClient() {}
void DelayedVerifyStrikeRegisterClient::VerifyNonceIsValidAndUnique(
StringPiece nonce,
QuicWallTime now,
ResultCallback* cb) {
if (delay_verifications_) {
pending_verifications_.push_back(VerifyArgs(nonce.as_string(), now, cb));
} else {
LocalStrikeRegisterClient::VerifyNonceIsValidAndUnique(nonce, now, cb);
}
}
int DelayedVerifyStrikeRegisterClient::PendingVerifications() const {
return pending_verifications_.size();
}
void DelayedVerifyStrikeRegisterClient::RunPendingVerifications() {
vector<VerifyArgs> pending;
pending_verifications_.swap(pending);
for (vector<VerifyArgs>::const_iterator it = pending.begin(),
end = pending.end(); it != end; ++it) {
LocalStrikeRegisterClient::VerifyNonceIsValidAndUnique(
it->nonce, it->now, it->cb);
}
}
}
}