| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "net/quic/test_tools/delayed_verify_strike_register_client.h" | |
| 6 | |
| 7 using base::StringPiece; | |
| 8 using std::string; | |
| 9 using std::vector; | |
| 10 | |
| 11 namespace net { | |
| 12 namespace test { | |
| 13 | |
| 14 DelayedVerifyStrikeRegisterClient::DelayedVerifyStrikeRegisterClient( | |
| 15 unsigned max_entries, | |
| 16 uint32 current_time_external, | |
| 17 uint32 window_secs, | |
| 18 const uint8 orbit[8], | |
| 19 StrikeRegister::StartupType startup) | |
| 20 : LocalStrikeRegisterClient(max_entries, current_time_external, | |
| 21 window_secs, orbit, startup), | |
| 22 delay_verifications_(false) { | |
| 23 } | |
| 24 | |
| 25 DelayedVerifyStrikeRegisterClient::~DelayedVerifyStrikeRegisterClient() {} | |
| 26 | |
| 27 void DelayedVerifyStrikeRegisterClient::VerifyNonceIsValidAndUnique( | |
| 28 StringPiece nonce, | |
| 29 QuicWallTime now, | |
| 30 ResultCallback* cb) { | |
| 31 if (delay_verifications_) { | |
| 32 pending_verifications_.push_back(VerifyArgs(nonce, now, cb)); | |
| 33 } else { | |
| 34 LocalStrikeRegisterClient::VerifyNonceIsValidAndUnique(nonce, now, cb); | |
| 35 } | |
| 36 } | |
| 37 | |
| 38 int DelayedVerifyStrikeRegisterClient::PendingVerifications() const { | |
| 39 return pending_verifications_.size(); | |
| 40 } | |
| 41 | |
| 42 void DelayedVerifyStrikeRegisterClient::RunPendingVerifications() { | |
| 43 vector<VerifyArgs> pending; | |
| 44 pending_verifications_.swap(pending); | |
| 45 for (vector<VerifyArgs>::const_iterator it = pending.begin(), | |
| 46 end = pending.end(); it != end; ++it) { | |
| 47 LocalStrikeRegisterClient::VerifyNonceIsValidAndUnique( | |
| 48 it->nonce, it->now, it->cb); | |
| 49 } | |
| 50 } | |
| 51 | |
| 52 } // namespace test | |
| 53 } // namespace net | |
| OLD | NEW |