OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/quic_simple_client.h" | 5 #include "net/tools/quic/quic_simple_client.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/http/http_request_info.h" | 10 #include "net/http/http_request_info.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 LOG_IF(DFATAL, !store_response_) << "Response not stored!"; | 291 LOG_IF(DFATAL, !store_response_) << "Response not stored!"; |
292 return latest_response_body_; | 292 return latest_response_body_; |
293 } | 293 } |
294 | 294 |
295 QuicConnectionId QuicSimpleClient::GenerateConnectionId() { | 295 QuicConnectionId QuicSimpleClient::GenerateConnectionId() { |
296 return helper_->GetRandomGenerator()->RandUint64(); | 296 return helper_->GetRandomGenerator()->RandUint64(); |
297 } | 297 } |
298 | 298 |
299 QuicConnectionHelper* QuicSimpleClient::CreateQuicConnectionHelper() { | 299 QuicConnectionHelper* QuicSimpleClient::CreateQuicConnectionHelper() { |
300 return new QuicConnectionHelper( | 300 return new QuicConnectionHelper( |
301 base::MessageLoop::current()->message_loop_proxy().get(), | 301 base::MessageLoop::current()->task_runner().get(), &clock_, |
302 &clock_, | |
303 QuicRandom::GetInstance()); | 302 QuicRandom::GetInstance()); |
304 } | 303 } |
305 | 304 |
306 QuicPacketWriter* QuicSimpleClient::CreateQuicPacketWriter() { | 305 QuicPacketWriter* QuicSimpleClient::CreateQuicPacketWriter() { |
307 return new QuicDefaultPacketWriter(socket_.get()); | 306 return new QuicDefaultPacketWriter(socket_.get()); |
308 } | 307 } |
309 | 308 |
310 void QuicSimpleClient::OnReadError(int result) { | 309 void QuicSimpleClient::OnReadError(int result) { |
311 LOG(ERROR) << "QuicSimpleClient read failed: " << ErrorToShortString(result); | 310 LOG(ERROR) << "QuicSimpleClient read failed: " << ErrorToShortString(result); |
312 Disconnect(); | 311 Disconnect(); |
313 } | 312 } |
314 | 313 |
315 bool QuicSimpleClient::OnPacket(const QuicEncryptedPacket& packet, | 314 bool QuicSimpleClient::OnPacket(const QuicEncryptedPacket& packet, |
316 IPEndPoint local_address, | 315 IPEndPoint local_address, |
317 IPEndPoint peer_address) { | 316 IPEndPoint peer_address) { |
318 session_->connection()->ProcessUdpPacket(local_address, peer_address, packet); | 317 session_->connection()->ProcessUdpPacket(local_address, peer_address, packet); |
319 if (!session_->connection()->connected()) { | 318 if (!session_->connection()->connected()) { |
320 return false; | 319 return false; |
321 } | 320 } |
322 | 321 |
323 return true; | 322 return true; |
324 } | 323 } |
325 | 324 |
326 } // namespace tools | 325 } // namespace tools |
327 } // namespace net | 326 } // namespace net |
OLD | NEW |