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 QuartcPacketWriter::QuartcPacketWriter( |
| 9 QuartcSessionInterface::Transport* transport) |
| 10 : transport_(transport) {} |
| 11 |
| 12 WriteResult QuartcPacketWriter::WritePacket(const char* buffer, |
| 13 size_t buf_len, |
| 14 const IPAddress& self_address, |
| 15 const IPEndPoint& peer_address, |
| 16 PerPacketOptions* options) { |
| 17 DCHECK(transport_); |
| 18 int bytes_written = transport_->Write(buffer, buf_len); |
| 19 if (bytes_written <= 0) { |
| 20 return WriteResult(WRITE_STATUS_BLOCKED, EWOULDBLOCK); |
| 21 } |
| 22 return WriteResult(WRITE_STATUS_OK, bytes_written); |
| 23 } |
| 24 |
| 25 bool QuartcPacketWriter::IsWriteBlockedDataBuffered() const { |
| 26 return false; |
| 27 } |
| 28 |
| 29 bool QuartcPacketWriter::IsWriteBlocked() const { |
| 30 DCHECK(transport_); |
| 31 return !transport_->CanWrite(); |
| 32 } |
| 33 |
| 34 // TODO(zhihuang) To figure out what is the better value to return. The |
| 35 // transport in WebRTC network layer may become the bottleneck when determining |
| 36 // the MTU. |
| 37 QuicByteCount QuartcPacketWriter::GetMaxPacketSize( |
| 38 const IPEndPoint& peer_address) const { |
| 39 return kMaxPacketSize; |
| 40 } |
| 41 |
| 42 void QuartcPacketWriter::SetWritable() {} |
| 43 |
| 44 } // namespace net |
OLD | NEW |