Internal QUICHE change PiperOrigin-RevId: 321428930 Change-Id: I43a8489065b3207e861fb6f3bac5afbeaf51f994
diff --git a/quic/core/quic_dispatcher.cc b/quic/core/quic_dispatcher.cc index 7cf9f51..e98359c 100644 --- a/quic/core/quic_dispatcher.cc +++ b/quic/core/quic_dispatcher.cc
@@ -1007,9 +1007,9 @@ server_connection_id = MaybeReplaceServerConnectionId(server_connection_id, packet_list.version); std::string alpn = SelectAlpn(packet_list.alpns); - std::unique_ptr<QuicSession> session = - CreateQuicSession(server_connection_id, packets.front().peer_address, - alpn, packet_list.version); + std::unique_ptr<QuicSession> session = CreateQuicSession( + server_connection_id, packets.front().self_address, + packets.front().peer_address, alpn, packet_list.version); if (original_connection_id != server_connection_id) { session->connection()->SetOriginalDestinationConnectionId( original_connection_id); @@ -1100,14 +1100,14 @@ original_connection_id, packet_info->version); // Creates a new session and process all buffered packets for this connection. std::string alpn = SelectAlpn(alpns); - std::unique_ptr<QuicSession> session = - CreateQuicSession(packet_info->destination_connection_id, - packet_info->peer_address, alpn, packet_info->version); + std::unique_ptr<QuicSession> session = CreateQuicSession( + packet_info->destination_connection_id, packet_info->self_address, + packet_info->peer_address, alpn, packet_info->version); if (QUIC_PREDICT_FALSE(session == nullptr)) { QUIC_BUG << "CreateQuicSession returned nullptr for " << packet_info->destination_connection_id << " from " - << packet_info->peer_address << " ALPN \"" << alpn << "\" version " - << packet_info->version; + << packet_info->peer_address << " to " << packet_info->self_address + << " ALPN \"" << alpn << "\" version " << packet_info->version; return; } if (original_connection_id != packet_info->destination_connection_id) {
diff --git a/quic/core/quic_dispatcher.h b/quic/core/quic_dispatcher.h index f0c35ea..e4c61e5 100644 --- a/quic/core/quic_dispatcher.h +++ b/quic/core/quic_dispatcher.h
@@ -138,6 +138,7 @@ protected: virtual std::unique_ptr<QuicSession> CreateQuicSession( QuicConnectionId server_connection_id, + const QuicSocketAddress& self_address, const QuicSocketAddress& peer_address, quiche::QuicheStringPiece alpn, const ParsedQuicVersion& version) = 0;
diff --git a/quic/core/quic_dispatcher_test.cc b/quic/core/quic_dispatcher_test.cc index 1d84b06..bd9bb7a 100644 --- a/quic/core/quic_dispatcher_test.cc +++ b/quic/core/quic_dispatcher_test.cc
@@ -133,6 +133,7 @@ MOCK_METHOD(std::unique_ptr<QuicSession>, CreateQuicSession, (QuicConnectionId connection_id, + const QuicSocketAddress& self_address, const QuicSocketAddress& peer_address, quiche::QuicheStringPiece alpn, const quic::ParsedQuicVersion& version), @@ -441,7 +442,7 @@ QuicConnectionId connection_id = TestConnectionId(++connection_id_); QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); EXPECT_CALL(*dispatcher_, - CreateQuicSession(connection_id, client_address, + CreateQuicSession(connection_id, _, client_address, Eq(ExpectedAlpnForVersion(version)), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, connection_id, client_address, @@ -463,7 +464,7 @@ QuicConnectionId connection_id = TestConnectionId(++connection_id_); QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); EXPECT_CALL(*dispatcher_, - CreateQuicSession(connection_id, client_address, _, _)) + CreateQuicSession(connection_id, _, client_address, _, _)) .Times(0); ProcessFirstFlight(version, client_address, connection_id); } @@ -506,7 +507,7 @@ QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(1), client_address, + CreateQuicSession(TestConnectionId(1), _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(1), client_address, @@ -557,7 +558,7 @@ // Processing the second packet should create the new session. EXPECT_CALL(*dispatcher_, - CreateQuicSession(server_connection_id, client_address, + CreateQuicSession(server_connection_id, _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, server_connection_id, client_address, @@ -626,7 +627,7 @@ // Processing the packet should create a new session. EXPECT_CALL(*dispatcher_, - CreateQuicSession(server_connection_id, client_address, + CreateQuicSession(server_connection_id, _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, server_connection_id, client_address, @@ -651,7 +652,7 @@ QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(1), client_address, + CreateQuicSession(TestConnectionId(1), _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(1), client_address, @@ -668,7 +669,7 @@ ProcessFirstFlight(client_address, TestConnectionId(1)); EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(2), client_address, + CreateQuicSession(TestConnectionId(2), _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(2), client_address, @@ -698,7 +699,7 @@ QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(1), client_address, + CreateQuicSession(TestConnectionId(1), _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(1), client_address, @@ -726,7 +727,7 @@ CreateTimeWaitListManager(); QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); EXPECT_CALL( *time_wait_list_manager_, SendVersionNegotiationPacket(TestConnectionId(1), _, _, _, _, _, _, _)) @@ -741,7 +742,7 @@ CreateTimeWaitListManager(); QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, SendVersionNegotiationPacket(connection_id, _, _, _, _, _, _, _)) .Times(1); @@ -754,7 +755,7 @@ CreateTimeWaitListManager(); QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, SendVersionNegotiationPacket( TestConnectionId(1), TestConnectionId(2), _, _, _, _, _, _)) @@ -767,7 +768,7 @@ CreateTimeWaitListManager(); QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, SendVersionNegotiationPacket(_, _, _, _, _, _, _, _)) .Times(0); @@ -791,7 +792,7 @@ CreateTimeWaitListManager(); QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, SendVersionNegotiationPacket(_, _, _, _, _, _, _, _)) .Times(1); @@ -810,7 +811,7 @@ QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); EXPECT_CALL(*dispatcher_, - CreateQuicSession(_, client_address, Eq(ExpectedAlpn()), _)) + CreateQuicSession(_, _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(1), client_address, &mock_helper_, &mock_alarm_factory_, &crypto_config_, @@ -838,7 +839,7 @@ // Create a new session. QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); QuicConnectionId connection_id = TestConnectionId(1); - EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address, + EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, connection_id, client_address, @@ -879,7 +880,7 @@ QuicConnectionId connection_id = TestConnectionId(1); // Dispatcher forwards all packets for this connection_id to the time wait // list manager. - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id, _, _)) .Times(0); @@ -900,7 +901,7 @@ QuicReceivedPacket packet(short_packet, 22, QuicTime::Zero()); char valid_size_packet[23] = {0x70, 0xa7, 0x02, 0x6c}; QuicReceivedPacket packet2(valid_size_packet, 23, QuicTime::Zero()); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) .Times(0); @@ -927,7 +928,7 @@ QuicUtils::CreateReplacementConnectionId(bad_connection_id); EXPECT_CALL(*dispatcher_, - CreateQuicSession(fixed_connection_id, client_address, + CreateQuicSession(fixed_connection_id, _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, fixed_connection_id, client_address, @@ -964,7 +965,7 @@ // validation is still enabled. EXPECT_CALL(*dispatcher_, - CreateQuicSession(fixed_connection_id, client_address, + CreateQuicSession(fixed_connection_id, _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, fixed_connection_id, client_address, @@ -995,7 +996,7 @@ QuicUtils::CreateReplacementConnectionId(bad_connection_id); EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(1), client_address, + CreateQuicSession(TestConnectionId(1), _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(1), client_address, @@ -1012,7 +1013,7 @@ ProcessFirstFlight(client_address, TestConnectionId(1)); EXPECT_CALL(*dispatcher_, - CreateQuicSession(fixed_connection_id, client_address, + CreateQuicSession(fixed_connection_id, _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, fixed_connection_id, client_address, @@ -1045,7 +1046,7 @@ // dispatcher_ should drop this packet. EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(1), client_address, _, _)) + CreateQuicSession(TestConnectionId(1), _, client_address, _, _)) .Times(0); EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) @@ -1064,7 +1065,7 @@ QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); // dispatcher_ should drop this packet. - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, client_address, _, _)) + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, client_address, _, _)) .Times(0); EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) @@ -1095,7 +1096,7 @@ 0xC0, 'Q', '0', '4', '9', /*connection ID length byte*/ 0x50}; QuicReceivedPacket received_packet49( packet49, kMinPacketSizeForVersionNegotiation, QuicTime::Zero()); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, SendVersionNegotiationPacket(_, _, _, _, _, _, _, _)) .Times(1); @@ -1108,7 +1109,7 @@ 0xC0, 'Q', '0', '4', '8', /*connection ID length byte*/ 0x50}; QuicReceivedPacket received_packet48( packet48, kMinPacketSizeForVersionNegotiation, QuicTime::Zero()); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, SendVersionNegotiationPacket(_, _, _, _, _, _, _, _)) .Times(1); @@ -1121,7 +1122,7 @@ 0xC0, 'Q', '0', '4', '7', /*connection ID length byte*/ 0x50}; QuicReceivedPacket received_packet47( packet47, kMinPacketSizeForVersionNegotiation, QuicTime::Zero()); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, SendVersionNegotiationPacket(_, _, _, _, _, _, _, _)) .Times(1); @@ -1134,7 +1135,7 @@ 0xC0, 'Q', '0', '4', '5', /*connection ID length byte*/ 0x50}; QuicReceivedPacket received_packet45( packet45, kMinPacketSizeForVersionNegotiation, QuicTime::Zero()); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, SendVersionNegotiationPacket(_, _, _, _, _, _, _, _)) .Times(1); @@ -1147,7 +1148,7 @@ 0xFF, 'Q', '0', '4', '4', /*connection ID length byte*/ 0x50}; QuicReceivedPacket received_packet44( packet44, kMinPacketSizeForVersionNegotiation, QuicTime::Zero()); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, SendVersionNegotiationPacket(_, _, _, _, _, _, _, _)) .Times(1); @@ -1180,7 +1181,7 @@ SendVersionNegotiationPacket(server_connection_id, client_connection_id, ietf_quic, use_length_prefix, _, _, _, _)) .Times(1); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); dispatcher_->ProcessPacket(server_address_, client_address, *received_packet); } @@ -1209,7 +1210,7 @@ SendVersionNegotiationPacket(server_connection_id, client_connection_id, ietf_quic, use_length_prefix, _, _, _, _)) .Times(1); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); dispatcher_->ProcessPacket(server_address_, client_address, *received_packet); } @@ -1260,7 +1261,7 @@ QuicEncryptedPacket encrypted(packet, sizeof(packet), false); std::unique_ptr<QuicReceivedPacket> received_packet( ConstructReceivedPacket(encrypted, mock_helper_.GetClock()->Now())); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); dispatcher_->ProcessPacket(server_address_, client_address, *received_packet); @@ -1304,7 +1305,7 @@ QuicEncryptedPacket encrypted(packet, sizeof(packet), false); std::unique_ptr<QuicReceivedPacket> received_packet( ConstructReceivedPacket(encrypted, mock_helper_.GetClock()->Now())); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); dispatcher_->ProcessPacket(server_address_, client_address, *received_packet); @@ -1356,7 +1357,7 @@ sizeof(packet), false); std::unique_ptr<QuicReceivedPacket> received_packet( ConstructReceivedPacket(encrypted, mock_helper_.GetClock()->Now())); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); dispatcher_->ProcessPacket(server_address_, client_address, *received_packet); @@ -1386,7 +1387,7 @@ CreateTimeWaitListManager(); QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, SendPacket(_, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) .Times(0); @@ -1447,7 +1448,7 @@ QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(1), client_address, + CreateQuicSession(TestConnectionId(1), _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(1), client_address, @@ -1465,7 +1466,7 @@ // No more new connections afterwards. EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(2), client_address, + CreateQuicSession(TestConnectionId(2), _, client_address, Eq(ExpectedAlpn()), _)) .Times(0u); ProcessFirstFlight(client_address, TestConnectionId(2)); @@ -1486,7 +1487,7 @@ // No more new connections afterwards. EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(2), client_address, + CreateQuicSession(TestConnectionId(2), _, client_address, Eq(ExpectedAlpn()), _)) .Times(0u); ProcessFirstFlight(client_address, TestConnectionId(2)); @@ -1495,7 +1496,7 @@ EXPECT_TRUE(dispatcher_->accept_new_connections()); EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(1), client_address, + CreateQuicSession(TestConnectionId(1), _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(1), client_address, @@ -1537,7 +1538,7 @@ QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); QuicConnectionId connection_id = TestConnectionId(1); - EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); + EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, _, _, _)).Times(0); EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) .Times(0); @@ -1578,7 +1579,7 @@ QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); EXPECT_CALL(*dispatcher_, - CreateQuicSession(_, client_address, Eq(ExpectedAlpn()), _)) + CreateQuicSession(_, _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(1), client_address, &helper_, &alarm_factory_, &crypto_config_, @@ -1594,7 +1595,7 @@ ProcessFirstFlight(client_address, TestConnectionId(1)); EXPECT_CALL(*dispatcher_, - CreateQuicSession(_, client_address, Eq(ExpectedAlpn()), _)) + CreateQuicSession(_, _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(2), client_address, &helper_, &alarm_factory_, &crypto_config_, @@ -1920,8 +1921,8 @@ // When CHLO arrives, a new session should be created, and all packets // buffered should be delivered to the session. - EXPECT_CALL(*dispatcher_, - CreateQuicSession(conn_id, client_addr_, Eq(ExpectedAlpn()), _)) + EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, _, client_addr_, + Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, conn_id, client_addr_, &mock_helper_, &mock_alarm_factory_, &crypto_config_, @@ -1955,8 +1956,8 @@ data_connection_map_[conn_id].pop_back(); // When CHLO arrives, a new session should be created, and all packets // buffered should be delivered to the session. - EXPECT_CALL(*dispatcher_, - CreateQuicSession(conn_id, client_addr_, Eq(ExpectedAlpn()), _)) + EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, _, client_addr_, + Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, conn_id, client_addr_, &mock_helper_, &mock_alarm_factory_, &crypto_config_, @@ -2007,7 +2008,7 @@ ShouldCreateOrBufferPacketForConnection( ReceivedPacketInfoConnectionIdEquals(conn_id))); } - EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_address, + EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, _, client_address, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, conn_id, client_address, &mock_helper_, @@ -2035,8 +2036,8 @@ QuicConnectionId conn_id = TestConnectionId(1); EXPECT_CALL(*dispatcher_, ShouldCreateOrBufferPacketForConnection( ReceivedPacketInfoConnectionIdEquals(conn_id))); - EXPECT_CALL(*dispatcher_, - CreateQuicSession(conn_id, client_addr_, Eq(ExpectedAlpn()), _)) + EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, _, client_addr_, + Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, conn_id, client_addr_, &mock_helper_, &mock_alarm_factory_, &crypto_config_, @@ -2055,8 +2056,8 @@ // When CHLO arrives, a new session should be created, and all packets // buffered should be delivered to the session. - EXPECT_CALL(*dispatcher_, - CreateQuicSession(conn_id, client_addr_, Eq(ExpectedAlpn()), _)) + EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, _, client_addr_, + Eq(ExpectedAlpn()), _)) .Times(1) // Only triggered by 1st CHLO. .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, conn_id, client_addr_, &mock_helper_, @@ -2125,7 +2126,7 @@ ReceivedPacketInfoConnectionIdEquals(TestConnectionId(conn_id)))); if (conn_id <= kMaxNumSessionsToCreate) { EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(conn_id), client_addr_, + CreateQuicSession(TestConnectionId(conn_id), _, client_addr_, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(conn_id), @@ -2160,7 +2161,7 @@ conn_id <= kMaxNumSessionsToCreate + kDefaultMaxConnectionsInStore; ++conn_id) { EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(conn_id), client_addr_, + CreateQuicSession(TestConnectionId(conn_id), _, client_addr_, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(conn_id), client_addr_, @@ -2176,7 +2177,7 @@ }))); } EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(kNumCHLOs), client_addr_, + CreateQuicSession(TestConnectionId(kNumCHLOs), _, client_addr_, Eq(ExpectedAlpn()), _)) .Times(0); @@ -2196,7 +2197,7 @@ // Last CHLO will be buffered. Others will create connection right away. if (conn_id <= kMaxNumSessionsToCreate) { EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(conn_id), client_addr_, + CreateQuicSession(TestConnectionId(conn_id), _, client_addr_, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(conn_id), @@ -2223,7 +2224,7 @@ size_t packets_buffered = 2; // Reset counter and process buffered CHLO. - EXPECT_CALL(*dispatcher_, CreateQuicSession(last_connection, client_addr_, + EXPECT_CALL(*dispatcher_, CreateQuicSession(last_connection, _, client_addr_, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, last_connection, client_addr_, @@ -2249,7 +2250,7 @@ // Last CHLO will be buffered. Others will create connection right away. if (conn_id <= kMaxNumSessionsToCreate) { EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(conn_id), client_addr_, + CreateQuicSession(TestConnectionId(conn_id), _, client_addr_, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(conn_id), @@ -2277,8 +2278,9 @@ } // Reset counter and process buffered CHLO. - EXPECT_CALL(*dispatcher_, CreateQuicSession(last_connection_id, client_addr_, - Eq(ExpectedAlpn()), _)) + EXPECT_CALL(*dispatcher_, + CreateQuicSession(last_connection_id, _, client_addr_, + Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, last_connection_id, client_addr_, &mock_helper_, &mock_alarm_factory_, &crypto_config_, @@ -2313,7 +2315,7 @@ ++conn_id) { if (conn_id <= kMaxNumSessionsToCreate + 1) { EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(conn_id), client_addr_, + CreateQuicSession(TestConnectionId(conn_id), _, client_addr_, Eq(ExpectedAlpn()), _)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(conn_id), @@ -2355,7 +2357,7 @@ if (conn_id <= kMaxNumSessionsToCreate) { EXPECT_CALL( *dispatcher_, - CreateQuicSession(TestConnectionId(conn_id), client_addr_, + CreateQuicSession(TestConnectionId(conn_id), _, client_addr_, Eq(ExpectedAlpnForVersion(version)), version)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(conn_id), @@ -2381,7 +2383,7 @@ ParsedQuicVersion version = supported_versions[(conn_id - 1) % supported_versions.size()]; EXPECT_CALL(*dispatcher_, - CreateQuicSession(TestConnectionId(conn_id), client_addr_, + CreateQuicSession(TestConnectionId(conn_id), _, client_addr_, Eq(ExpectedAlpnForVersion(version)), version)) .WillOnce(Return(ByMove(CreateSession( dispatcher_.get(), config_, TestConnectionId(conn_id), client_addr_,
diff --git a/quic/masque/masque_dispatcher.cc b/quic/masque/masque_dispatcher.cc index 9856fb4..ff9d2cf 100644 --- a/quic/masque/masque_dispatcher.cc +++ b/quic/masque/masque_dispatcher.cc
@@ -28,12 +28,13 @@ std::unique_ptr<QuicSession> MasqueDispatcher::CreateQuicSession( QuicConnectionId connection_id, - const QuicSocketAddress& client_address, + const QuicSocketAddress& /*self_address*/, + const QuicSocketAddress& peer_address, quiche::QuicheStringPiece /*alpn*/, const ParsedQuicVersion& version) { // The MasqueServerSession takes ownership of |connection| below. QuicConnection* connection = new QuicConnection( - connection_id, client_address, helper(), alarm_factory(), writer(), + connection_id, peer_address, helper(), alarm_factory(), writer(), /*owns_writer=*/false, Perspective::IS_SERVER, ParsedQuicVersionVector{version});
diff --git a/quic/masque/masque_dispatcher.h b/quic/masque/masque_dispatcher.h index 6901a86..e663b1c 100644 --- a/quic/masque/masque_dispatcher.h +++ b/quic/masque/masque_dispatcher.h
@@ -34,7 +34,8 @@ // From QuicSimpleDispatcher. std::unique_ptr<QuicSession> CreateQuicSession( QuicConnectionId connection_id, - const QuicSocketAddress& client_address, + const QuicSocketAddress& self_address, + const QuicSocketAddress& peer_address, quiche::QuicheStringPiece alpn, const ParsedQuicVersion& version) override;
diff --git a/quic/qbone/qbone_client_test.cc b/quic/qbone/qbone_client_test.cc index 91be62a..cfe6c46 100644 --- a/quic/qbone/qbone_client_test.cc +++ b/quic/qbone/qbone_client_test.cc
@@ -123,14 +123,15 @@ std::unique_ptr<QuicSession> CreateQuicSession( QuicConnectionId id, - const QuicSocketAddress& client, + const QuicSocketAddress& /*self_address*/, + const QuicSocketAddress& peer_address, quiche::QuicheStringPiece alpn, const quic::ParsedQuicVersion& version) override { CHECK_EQ(alpn, "qbone"); - QuicConnection* connection = - new QuicConnection(id, client, helper(), alarm_factory(), writer(), - /* owns_writer= */ false, Perspective::IS_SERVER, - ParsedQuicVersionVector{version}); + QuicConnection* connection = new QuicConnection( + id, peer_address, helper(), alarm_factory(), writer(), + /* owns_writer= */ false, Perspective::IS_SERVER, + ParsedQuicVersionVector{version}); // The connection owning wrapper owns the connection created. auto session = std::make_unique<ConnectionOwningQboneServerSession>( GetSupportedVersions(), connection, this, config(), crypto_config(),
diff --git a/quic/test_tools/quic_test_server.cc b/quic/test_tools/quic_test_server.cc index 1b6452e..85a86b7 100644 --- a/quic/test_tools/quic_test_server.cc +++ b/quic/test_tools/quic_test_server.cc
@@ -95,18 +95,20 @@ std::unique_ptr<QuicSession> CreateQuicSession( QuicConnectionId id, - const QuicSocketAddress& client, + const QuicSocketAddress& self_address, + const QuicSocketAddress& peer_address, quiche::QuicheStringPiece alpn, const ParsedQuicVersion& version) override { QuicReaderMutexLock lock(&factory_lock_); if (session_factory_ == nullptr && stream_factory_ == nullptr && crypto_stream_factory_ == nullptr) { - return QuicSimpleDispatcher::CreateQuicSession(id, client, alpn, version); + return QuicSimpleDispatcher::CreateQuicSession( + id, self_address, peer_address, alpn, version); } - QuicConnection* connection = - new QuicConnection(id, client, helper(), alarm_factory(), writer(), - /* owns_writer= */ false, Perspective::IS_SERVER, - ParsedQuicVersionVector{version}); + QuicConnection* connection = new QuicConnection( + id, peer_address, helper(), alarm_factory(), writer(), + /* owns_writer= */ false, Perspective::IS_SERVER, + ParsedQuicVersionVector{version}); std::unique_ptr<QuicServerSessionBase> session; if (stream_factory_ != nullptr || crypto_stream_factory_ != nullptr) {
diff --git a/quic/tools/quic_simple_dispatcher.cc b/quic/tools/quic_simple_dispatcher.cc index e361511..eb06dd5 100644 --- a/quic/tools/quic_simple_dispatcher.cc +++ b/quic/tools/quic_simple_dispatcher.cc
@@ -50,12 +50,13 @@ std::unique_ptr<QuicSession> QuicSimpleDispatcher::CreateQuicSession( QuicConnectionId connection_id, - const QuicSocketAddress& client_address, + const QuicSocketAddress& /*self_address*/, + const QuicSocketAddress& peer_address, quiche::QuicheStringPiece /*alpn*/, const ParsedQuicVersion& version) { // The QuicServerSessionBase takes ownership of |connection| below. QuicConnection* connection = new QuicConnection( - connection_id, client_address, helper(), alarm_factory(), writer(), + connection_id, peer_address, helper(), alarm_factory(), writer(), /* owns_writer= */ false, Perspective::IS_SERVER, ParsedQuicVersionVector{version});
diff --git a/quic/tools/quic_simple_dispatcher.h b/quic/tools/quic_simple_dispatcher.h index dbb5fdf..c01359d 100644 --- a/quic/tools/quic_simple_dispatcher.h +++ b/quic/tools/quic_simple_dispatcher.h
@@ -33,7 +33,8 @@ protected: std::unique_ptr<QuicSession> CreateQuicSession( QuicConnectionId connection_id, - const QuicSocketAddress& client_address, + const QuicSocketAddress& self_address, + const QuicSocketAddress& peer_address, quiche::QuicheStringPiece alpn, const ParsedQuicVersion& version) override;
diff --git a/quic/tools/quic_transport_simple_server_dispatcher.cc b/quic/tools/quic_transport_simple_server_dispatcher.cc index 55a0674..d445b54 100644 --- a/quic/tools/quic_transport_simple_server_dispatcher.cc +++ b/quic/tools/quic_transport_simple_server_dispatcher.cc
@@ -36,6 +36,7 @@ std::unique_ptr<QuicSession> QuicTransportSimpleServerDispatcher::CreateQuicSession( QuicConnectionId server_connection_id, + const QuicSocketAddress& /*self_address*/, const QuicSocketAddress& peer_address, quiche::QuicheStringPiece /*alpn*/, const ParsedQuicVersion& version) {
diff --git a/quic/tools/quic_transport_simple_server_dispatcher.h b/quic/tools/quic_transport_simple_server_dispatcher.h index cc3f76e..da27585 100644 --- a/quic/tools/quic_transport_simple_server_dispatcher.h +++ b/quic/tools/quic_transport_simple_server_dispatcher.h
@@ -29,6 +29,7 @@ protected: std::unique_ptr<QuicSession> CreateQuicSession( QuicConnectionId server_connection_id, + const QuicSocketAddress& self_address, const QuicSocketAddress& peer_address, quiche::QuicheStringPiece alpn, const ParsedQuicVersion& version) override;