OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/test_tools/packet_dropping_test_writer.h" | 5 #include "net/tools/quic/test_tools/packet_dropping_test_writer.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "net/tools/quic/quic_epoll_connection_helper.h" | 10 #include "net/tools/quic/quic_epoll_connection_helper.h" |
11 #include "net/tools/quic/quic_socket_utils.h" | 11 #include "net/tools/quic/quic_socket_utils.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 namespace tools { | 14 namespace tools { |
15 namespace test { | 15 namespace test { |
16 | 16 |
17 // An alarm that is scheduled if a blocked socket is simulated to indicate | 17 // An alarm that is scheduled if a blocked socket is simulated to indicate |
18 // it's writable again. | 18 // it's writable again. |
19 class WriteUnblockedAlarm : public QuicAlarm::Delegate { | 19 class WriteUnblockedAlarm : public QuicAlarm::Delegate { |
20 public: | 20 public: |
21 explicit WriteUnblockedAlarm(PacketDroppingTestWriter* writer) | 21 explicit WriteUnblockedAlarm(PacketDroppingTestWriter* writer) |
22 : writer_(writer) { } | 22 : writer_(writer) { } |
23 | 23 |
24 virtual QuicTime OnAlarm() OVERRIDE { | 24 virtual QuicTime OnAlarm() OVERRIDE { |
25 DCHECK(writer_->blocked_writer()); | 25 DCHECK(writer_->blocked_writer()); |
26 DLOG(INFO) << "Unblocking socket."; | 26 DVLOG(1) << "Unblocking socket."; |
27 writer_->blocked_writer()->OnCanWrite(); | 27 writer_->blocked_writer()->OnCanWrite(); |
28 return QuicTime::Zero(); | 28 return QuicTime::Zero(); |
29 } | 29 } |
30 | 30 |
31 private: | 31 private: |
32 PacketDroppingTestWriter* writer_; | 32 PacketDroppingTestWriter* writer_; |
33 }; | 33 }; |
34 | 34 |
35 // An alarm that is scheduled every time a new packet is to be written at a | 35 // An alarm that is scheduled every time a new packet is to be written at a |
36 // later point. | 36 // later point. |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 : buffer(buffer, buf_len), | 202 : buffer(buffer, buf_len), |
203 self_address(self_address), | 203 self_address(self_address), |
204 peer_address(peer_address), | 204 peer_address(peer_address), |
205 send_time(send_time) {} | 205 send_time(send_time) {} |
206 | 206 |
207 PacketDroppingTestWriter::DelayedWrite::~DelayedWrite() {} | 207 PacketDroppingTestWriter::DelayedWrite::~DelayedWrite() {} |
208 | 208 |
209 } // namespace test | 209 } // namespace test |
210 } // namespace tools | 210 } // namespace tools |
211 } // namespace net | 211 } // namespace net |
OLD | NEW |