OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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 QuicByteCount QuartcPacketWriter::GetMaxPacketSize( | |
35 const IPEndPoint& peer_address) const { | |
36 return kMaxPacketSize; | |
skvlad-chromium
2016/09/22 01:54:25
Is this always correct? The underlying transport s
zhihuang1
2016/09/22 18:53:52
This is a good point. I am not ware of the package
| |
37 } | |
38 | |
39 void QuartcPacketWriter::SetWritable() {} | |
40 | |
41 } // namespace net | |
OLD | NEW |