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/quic_default_packet_writer.h" | 5 #include "net/tools/quic/quic_default_packet_writer.h" |
6 | 6 |
7 #include "net/tools/quic/quic_socket_utils.h" | 7 #include "net/tools/quic/quic_socket_utils.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
11 QuicDefaultPacketWriter::QuicDefaultPacketWriter(int fd) | 11 QuicDefaultPacketWriter::QuicDefaultPacketWriter(int fd) |
12 : fd_(fd), write_blocked_(false) {} | 12 : fd_(fd), write_blocked_(false) {} |
13 | 13 |
14 QuicDefaultPacketWriter::~QuicDefaultPacketWriter() {} | 14 QuicDefaultPacketWriter::~QuicDefaultPacketWriter() {} |
15 | 15 |
16 WriteResult QuicDefaultPacketWriter::WritePacket( | 16 WriteResult QuicDefaultPacketWriter::WritePacket( |
17 const char* buffer, | 17 const char* buffer, |
18 size_t buf_len, | 18 size_t buf_len, |
19 const IPAddressNumber& self_address, | 19 const IPAddressNumber& self_address, |
20 const IPEndPoint& peer_address) { | 20 const IPEndPoint& peer_address, |
| 21 PerPacketOptions* options) { |
21 DCHECK(!IsWriteBlocked()); | 22 DCHECK(!IsWriteBlocked()); |
| 23 DCHECK(nullptr == options) |
| 24 << "QuicDefaultPacketWriter does not accept any options."; |
22 WriteResult result = QuicSocketUtils::WritePacket(fd_, buffer, buf_len, | 25 WriteResult result = QuicSocketUtils::WritePacket(fd_, buffer, buf_len, |
23 self_address, peer_address); | 26 self_address, peer_address); |
24 if (result.status == WRITE_STATUS_BLOCKED) { | 27 if (result.status == WRITE_STATUS_BLOCKED) { |
25 write_blocked_ = true; | 28 write_blocked_ = true; |
26 } | 29 } |
27 return result; | 30 return result; |
28 } | 31 } |
29 | 32 |
30 bool QuicDefaultPacketWriter::IsWriteBlockedDataBuffered() const { | 33 bool QuicDefaultPacketWriter::IsWriteBlockedDataBuffered() const { |
31 return false; | 34 return false; |
32 } | 35 } |
33 | 36 |
34 bool QuicDefaultPacketWriter::IsWriteBlocked() const { | 37 bool QuicDefaultPacketWriter::IsWriteBlocked() const { |
35 return write_blocked_; | 38 return write_blocked_; |
36 } | 39 } |
37 | 40 |
38 void QuicDefaultPacketWriter::SetWritable() { | 41 void QuicDefaultPacketWriter::SetWritable() { |
39 write_blocked_ = false; | 42 write_blocked_ = false; |
40 } | 43 } |
41 | 44 |
42 QuicByteCount QuicDefaultPacketWriter::GetMaxPacketSize( | 45 QuicByteCount QuicDefaultPacketWriter::GetMaxPacketSize( |
43 const IPEndPoint& peer_address) const { | 46 const IPEndPoint& peer_address) const { |
44 return kMaxPacketSize; | 47 return kMaxPacketSize; |
45 } | 48 } |
46 | 49 |
47 } // namespace net | 50 } // namespace net |
OLD | NEW |