Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2016 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/quartc/quartc_packet_writer.h" | |
| 6 | |
| 7 namespace net { | |
| 8 | |
| 9 QuartcPacketWriter::QuartcPacketWriter( | |
| 10 QuartcSessionInterface::PacketTransport* packet_transport) | |
| 11 : packet_transport_(packet_transport) {} | |
| 12 | |
| 13 WriteResult QuartcPacketWriter::WritePacket(const char* buffer, | |
| 14 size_t buf_len, | |
| 15 const IPAddress& self_address, | |
| 16 const IPEndPoint& peer_address, | |
| 17 PerPacketOptions* options) { | |
| 18 DCHECK(packet_transport_); | |
| 19 int bytes_written = packet_transport_->Write(buffer, buf_len); | |
| 20 if (bytes_written <= 0) { | |
| 21 return WriteResult(WRITE_STATUS_BLOCKED, EWOULDBLOCK); | |
| 22 } | |
| 23 return WriteResult(WRITE_STATUS_OK, bytes_written); | |
| 24 } | |
| 25 | |
| 26 bool QuartcPacketWriter::IsWriteBlockedDataBuffered() const { | |
| 27 return false; | |
| 28 } | |
| 29 | |
| 30 bool QuartcPacketWriter::IsWriteBlocked() const { | |
| 31 DCHECK(packet_transport_); | |
| 32 return !packet_transport_->CanWrite(); | |
| 33 } | |
| 34 | |
| 35 // TODO(zhihuang) To figure out what is the better value to return. The | |
|
pthatcher1
2016/10/14 18:59:00
"To figure out" => Figure out
zhihuang1
2016/10/16 00:45:28
Done.
| |
| 36 // transport in WebRTC network layer may become the bottleneck when determining | |
| 37 // the MTU. | |
|
pthatcher1
2016/10/14 18:59:00
We should probably make this an option in the Quar
zhihuang1
2016/10/16 00:45:28
Agreed. This is a good point.
Because the PacketT
| |
| 38 QuicByteCount QuartcPacketWriter::GetMaxPacketSize( | |
| 39 const IPEndPoint& peer_address) const { | |
| 40 return kMaxPacketSize; | |
| 41 } | |
| 42 | |
| 43 void QuartcPacketWriter::SetWritable() {} | |
| 44 | |
| 45 } // namespace net | |
| OLD | NEW |