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
3 // found in the LICENSE file.
5 #include "net/tools/quic/quic_default_packet_writer.h"
7 #include "net/tools/quic/quic_socket_utils.h"
12 QuicDefaultPacketWriter::QuicDefaultPacketWriter(int fd
)
14 write_blocked_(false) {}
16 QuicDefaultPacketWriter::~QuicDefaultPacketWriter() {}
18 WriteResult
QuicDefaultPacketWriter::WritePacket(
21 const IPAddressNumber
& self_address
,
22 const IPEndPoint
& peer_address
) {
23 DCHECK(!IsWriteBlocked());
24 WriteResult result
= QuicSocketUtils::WritePacket(
25 fd_
, buffer
, buf_len
, self_address
, peer_address
);
26 if (result
.status
== WRITE_STATUS_BLOCKED
) {
27 write_blocked_
= true;
32 bool QuicDefaultPacketWriter::IsWriteBlockedDataBuffered() const {
36 bool QuicDefaultPacketWriter::IsWriteBlocked() const {
37 return write_blocked_
;
40 void QuicDefaultPacketWriter::SetWritable() {
41 write_blocked_
= false;