Refactor PerPacketOptions for QuicWriter. From the bug:
per_packet_options_ was originally designed as a vehicle for platforms to get specific instructions to their corresponding QuicWriters via a QuicConnection that didn't understand the semantics of those instructions. Therefore, it is passed to QuicConnection as a piece of memory of which the platform retains ownership.
Over time, other instructions specific to QuicConnection have appeared in this struct, as it provides a vehicle to send information to QuicWriter without changing APIs. But this violates the intent of the struct, makes Quiche functions reliant on a piece of memory owned by the platform, and is bug prone (e.g., if the platform provides the same piece of memory for all connections in a dispatcher, the outcome will be very bad).
PiperOrigin-RevId: 534577370
diff --git a/quiche/quic/qbone/qbone_session_test.cc b/quiche/quic/qbone/qbone_session_test.cc
index 1a9d023..ab92c1c 100644
--- a/quiche/quic/qbone/qbone_session_test.cc
+++ b/quiche/quic/qbone/qbone_session_test.cc
@@ -355,11 +355,12 @@
// Hook everything up!
MockPacketWriter* client_writer = static_cast<MockPacketWriter*>(
QuicConnectionPeer::GetWriter(client_peer_->connection()));
- ON_CALL(*client_writer, WritePacket(_, _, _, _, _))
+ ON_CALL(*client_writer, WritePacket(_, _, _, _, _, _))
.WillByDefault(Invoke([this](const char* buffer, size_t buf_len,
const QuicIpAddress& self_address,
const QuicSocketAddress& peer_address,
- PerPacketOptions* options) {
+ PerPacketOptions* option,
+ const QuicPacketWriterParams& params) {
char* copy = new char[1024 * 1024];
memcpy(copy, buffer, buf_len);
runner_.Schedule([this, copy, buf_len] {
@@ -373,11 +374,12 @@
}));
MockPacketWriter* server_writer = static_cast<MockPacketWriter*>(
QuicConnectionPeer::GetWriter(server_peer_->connection()));
- ON_CALL(*server_writer, WritePacket(_, _, _, _, _))
+ ON_CALL(*server_writer, WritePacket(_, _, _, _, _, _))
.WillByDefault(Invoke([this](const char* buffer, size_t buf_len,
const QuicIpAddress& self_address,
const QuicSocketAddress& peer_address,
- PerPacketOptions* options) {
+ PerPacketOptions* options,
+ const QuicPacketWriterParams& params) {
char* copy = new char[1024 * 1024];
memcpy(copy, buffer, buf_len);
runner_.Schedule([this, copy, buf_len] {