Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: net/quic/crypto/local_strike_register_client.cc

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/crypto/local_strike_register_client.h"
6
7 #include "net/quic/crypto/crypto_protocol.h"
8
9 using base::StringPiece;
10 using std::string;
11
12 namespace net {
13
14 LocalStrikeRegisterClient::LocalStrikeRegisterClient(
15 unsigned max_entries,
16 uint32 current_time_external,
17 uint32 window_secs,
18 const uint8 orbit[8],
19 StrikeRegister::StartupType startup)
20 : strike_register_(max_entries, current_time_external, window_secs,
21 orbit, startup) {
22 }
23
24 bool LocalStrikeRegisterClient::IsKnownOrbit(StringPiece orbit) const {
25 base::AutoLock lock(m_);
26 if (orbit.length() != kOrbitSize) {
27 return false;
28 }
29 return memcmp(orbit.data(), strike_register_.orbit(), kOrbitSize) == 0;
30 }
31
32 void LocalStrikeRegisterClient::VerifyNonceIsValidAndUnique(
33 StringPiece nonce,
34 QuicWallTime now,
35 ResultCallback* cb) {
36 InsertStatus nonce_error;
37 if (nonce.length() != kNonceSize) {
38 nonce_error = NONCE_INVALID_FAILURE;
39 } else {
40 base::AutoLock lock(m_);
41 nonce_error = strike_register_.Insert(
42 reinterpret_cast<const uint8*>(nonce.data()),
43 static_cast<uint32>(now.ToUNIXSeconds()));
44 }
45
46 // m_ must not be held when the ResultCallback runs.
47 cb->Run((nonce_error == NONCE_OK), nonce_error);
48 }
49
50 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/local_strike_register_client.h ('k') | net/quic/crypto/local_strike_register_client_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698