Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / net / tools / quic / quic_default_packet_writer.cc
blob84f118aee0098a1cba1b34a5e6b40f546dd724cb
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"
9 namespace net {
10 namespace tools {
12 QuicDefaultPacketWriter::QuicDefaultPacketWriter(int fd)
13 : fd_(fd),
14 write_blocked_(false) {}
16 QuicDefaultPacketWriter::~QuicDefaultPacketWriter() {}
18 WriteResult QuicDefaultPacketWriter::WritePacket(
19 const char* buffer,
20 size_t buf_len,
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;
29 return result;
32 bool QuicDefaultPacketWriter::IsWriteBlockedDataBuffered() const {
33 return false;
36 bool QuicDefaultPacketWriter::IsWriteBlocked() const {
37 return write_blocked_;
40 void QuicDefaultPacketWriter::SetWritable() {
41 write_blocked_ = false;
44 } // namespace tools
45 } // namespace net