Index: net/quic/quic_connection.cc |
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc |
index b107ee44ba1eaf514f70a288eefa3dc5bb86bde5..c49535589465045af279a804a296b483409bab42 100644 |
--- a/net/quic/quic_connection.cc |
+++ b/net/quic/quic_connection.cc |
@@ -244,6 +244,7 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id, |
migrating_peer_port_(0), |
last_packet_decrypted_(false), |
last_size_(0), |
+ current_packet_data_(nullptr), |
last_decrypted_packet_level_(ENCRYPTION_NONE), |
should_last_packet_instigate_acks_(false), |
largest_seen_packet_with_ack_(0), |
@@ -1213,6 +1214,7 @@ void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address, |
debug_visitor_->OnPacketReceived(self_address, peer_address, packet); |
} |
last_size_ = packet.length(); |
+ current_packet_data_ = packet.data(); |
if (FLAGS_check_peer_address_change_after_decryption) { |
last_packet_destination_address_ = self_address; |
@@ -1244,6 +1246,7 @@ void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address, |
} |
DVLOG(1) << ENDPOINT << "Unable to process packet. Last packet processed: " |
<< last_header_.packet_number; |
+ current_packet_data_ = nullptr; |
return; |
} |
@@ -1251,6 +1254,7 @@ void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address, |
MaybeProcessUndecryptablePackets(); |
MaybeSendInResponseToPacket(); |
SetPingAlarm(); |
+ current_packet_data_ = nullptr; |
} |
void QuicConnection::CheckForAddressMigration(const IPEndPoint& self_address, |
@@ -2340,4 +2344,11 @@ bool QuicConnection::ack_frame_updated() const { |
return received_packet_manager_.ack_frame_updated(); |
} |
+StringPiece QuicConnection::GetCurrentPacket() { |
+ if (current_packet_data_ == nullptr) { |
+ return StringPiece(); |
+ } |
+ return StringPiece(current_packet_data_, last_size_); |
+} |
+ |
} // namespace net |