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::Transport* transport) | |
| 11 : transport_(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(transport_); | |
| 19 int bytes_written = 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(transport_); | |
| 32 return !transport_->CanWrite(); | |
| 33 } | |
| 34 | |
| 35 // TODO(zhihuang) To figure out what is the better value to return. The | |
| 36 // transport in WebRTC network layer may become the bottleneck when determining | |
| 37 // the MTU. | |
| 38 QuicByteCount QuartcPacketWriter::GetMaxPacketSize( | |
| 39 const IPEndPoint& peer_address) const { | |
| 40 return kMaxPacketSize; | |
|
pthatcher2
2016/10/05 22:12:06
We may want to drop it somewhat so that TURN encap
zhihuang1
2016/10/13 06:22:40
Make it half?
pthatcher1
2016/10/14 18:58:58
No, that's way too drastic. I looked into our cur
| |
| 41 } | |
| 42 | |
| 43 void QuartcPacketWriter::SetWritable() {} | |
| 44 | |
| 45 } // namespace net | |
| OLD | NEW |