Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(805)

Unified Diff: net/tools/quic/test_tools/limited_mtu_test_writer.cc

Issue 1240953002: Allow QuicClient to set connection MTU before the handshake is sent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Cleanup_changes_97160447
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/test_tools/limited_mtu_test_writer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/test_tools/limited_mtu_test_writer.cc
diff --git a/net/tools/quic/test_tools/limited_mtu_test_writer.cc b/net/tools/quic/test_tools/limited_mtu_test_writer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1e9fa7daa7985ce41a7106ce3b5a7f50e040e1ef
--- /dev/null
+++ b/net/tools/quic/test_tools/limited_mtu_test_writer.cc
@@ -0,0 +1,31 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/tools/quic/test_tools/limited_mtu_test_writer.h"
+
+namespace net {
+namespace tools {
+namespace test {
+
+LimitedMtuTestWriter::LimitedMtuTestWriter(QuicByteCount mtu) : mtu_(mtu) {}
+
+LimitedMtuTestWriter::~LimitedMtuTestWriter() {}
+
+WriteResult LimitedMtuTestWriter::WritePacket(
+ const char* buffer,
+ size_t buf_len,
+ const IPAddressNumber& self_address,
+ const IPEndPoint& peer_address) {
+ if (buf_len > mtu_) {
+ // Drop the packet.
+ return WriteResult(WRITE_STATUS_OK, buf_len);
+ }
+
+ return QuicPacketWriterWrapper::WritePacket(buffer, buf_len, self_address,
+ peer_address);
+}
+
+} // namespace test
+} // namespace tools
+} // namespace net
« no previous file with comments | « net/tools/quic/test_tools/limited_mtu_test_writer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698