OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/tools/quic/stateless_rejector.h" | 5 #include "net/tools/quic/stateless_rejector.h" |
6 | 6 |
7 #include "net/quic/core/quic_bug_tracker.h" | 7 #include "net/quic/core/quic_bug_tracker.h" |
8 #include "net/quic/core/quic_crypto_server_stream.h" | 8 #include "net/quic/core/quic_crypto_server_stream.h" |
9 #include "net/quic/core/quic_flags.h" | 9 #include "net/quic/core/quic_flags.h" |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 return; | 74 return; |
75 } | 75 } |
76 | 76 |
77 connection_id_ = connection_id; | 77 connection_id_ = connection_id; |
78 server_designated_connection_id_ = server_designated_connection_id; | 78 server_designated_connection_id_ = server_designated_connection_id; |
79 chlo_ = message; // Note: copies the message | 79 chlo_ = message; // Note: copies the message |
80 } | 80 } |
81 | 81 |
82 void StatelessRejector::Process(std::unique_ptr<StatelessRejector> rejector, | 82 void StatelessRejector::Process(std::unique_ptr<StatelessRejector> rejector, |
83 std::unique_ptr<ProcessDoneCallback> done_cb) { | 83 std::unique_ptr<ProcessDoneCallback> done_cb) { |
84 // If we were able to make a decision about this CHLO based purely on the | 84 QUIC_BUG_IF(rejector->state() != UNKNOWN) << "StatelessRejector::Process " |
85 // information available in OnChlo, just invoke the done callback immediately. | 85 "called for a rejector which " |
86 if (rejector->state() != UNKNOWN) { | 86 "has already made a decision"; |
87 done_cb->Run(std::move(rejector)); | |
88 return; | |
89 } | |
90 | |
91 StatelessRejector* rejector_ptr = rejector.get(); | 87 StatelessRejector* rejector_ptr = rejector.get(); |
92 rejector_ptr->crypto_config_->ValidateClientHello( | 88 rejector_ptr->crypto_config_->ValidateClientHello( |
93 rejector_ptr->chlo_, rejector_ptr->client_address_.address(), | 89 rejector_ptr->chlo_, rejector_ptr->client_address_.address(), |
94 rejector_ptr->server_address_.address(), rejector_ptr->version_, | 90 rejector_ptr->server_address_.address(), rejector_ptr->version_, |
95 rejector_ptr->clock_, &rejector_ptr->proof_, | 91 rejector_ptr->clock_, &rejector_ptr->proof_, |
96 std::unique_ptr<ValidateCallback>( | 92 std::unique_ptr<ValidateCallback>( |
97 new ValidateCallback(std::move(rejector), std::move(done_cb)))); | 93 new ValidateCallback(std::move(rejector), std::move(done_cb)))); |
98 } | 94 } |
99 | 95 |
100 class StatelessRejector::ProcessClientHelloCallback | 96 class StatelessRejector::ProcessClientHelloCallback |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 state_ = FAILED; | 147 state_ = FAILED; |
152 } else if (reply_->tag() == kSREJ) { | 148 } else if (reply_->tag() == kSREJ) { |
153 state_ = REJECTED; | 149 state_ = REJECTED; |
154 } else { | 150 } else { |
155 state_ = ACCEPTED; | 151 state_ = ACCEPTED; |
156 } | 152 } |
157 done_cb->Run(std::move(rejector)); | 153 done_cb->Run(std::move(rejector)); |
158 } | 154 } |
159 | 155 |
160 } // namespace net | 156 } // namespace net |
OLD | NEW |