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

Unified Diff: net/quic/core/quic_protocol.cc

Issue 2229703003: Introduce TTL in QuicReceivedPacket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@129359661
Patch Set: git pull from upper stream Created 4 years, 4 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/quic/core/quic_protocol.h ('k') | net/tools/quic/quic_packet_reader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_protocol.cc
diff --git a/net/quic/core/quic_protocol.cc b/net/quic/core/quic_protocol.cc
index 20e64fafd3276c4819b53ce549d10c196954a5ed..aff9d26831f6d1afe988600e9ac093cd3e0ee929 100644
--- a/net/quic/core/quic_protocol.cc
+++ b/net/quic/core/quic_protocol.cc
@@ -738,7 +738,7 @@ QuicGoAwayFrame::QuicGoAwayFrame(QuicErrorCode error_code,
QuicData::QuicData(const char* buffer, size_t length)
: buffer_(buffer), length_(length), owns_buffer_(false) {}
-QuicData::QuicData(char* buffer, size_t length, bool owns_buffer)
+QuicData::QuicData(const char* buffer, size_t length, bool owns_buffer)
: buffer_(buffer), length_(length), owns_buffer_(owns_buffer) {}
QuicData::~QuicData() {
@@ -775,7 +775,7 @@ QuicPacket::QuicPacket(char* buffer,
QuicEncryptedPacket::QuicEncryptedPacket(const char* buffer, size_t length)
: QuicData(buffer, length) {}
-QuicEncryptedPacket::QuicEncryptedPacket(char* buffer,
+QuicEncryptedPacket::QuicEncryptedPacket(const char* buffer,
size_t length,
bool owns_buffer)
: QuicData(buffer, length, owns_buffer) {}
@@ -794,19 +794,33 @@ ostream& operator<<(ostream& os, const QuicEncryptedPacket& s) {
QuicReceivedPacket::QuicReceivedPacket(const char* buffer,
size_t length,
QuicTime receipt_time)
- : QuicEncryptedPacket(buffer, length), receipt_time_(receipt_time) {}
+ : QuicEncryptedPacket(buffer, length),
+ receipt_time_(receipt_time),
+ ttl_(0) {}
-QuicReceivedPacket::QuicReceivedPacket(char* buffer,
+QuicReceivedPacket::QuicReceivedPacket(const char* buffer,
size_t length,
QuicTime receipt_time,
bool owns_buffer)
: QuicEncryptedPacket(buffer, length, owns_buffer),
- receipt_time_(receipt_time) {}
+ receipt_time_(receipt_time),
+ ttl_(0) {}
+
+QuicReceivedPacket::QuicReceivedPacket(const char* buffer,
+ size_t length,
+ QuicTime receipt_time,
+ bool owns_buffer,
+ int ttl,
+ bool ttl_valid)
+ : QuicEncryptedPacket(buffer, length, owns_buffer),
+ receipt_time_(receipt_time),
+ ttl_(ttl_valid ? ttl : -1) {}
QuicReceivedPacket* QuicReceivedPacket::Clone() const {
char* buffer = new char[this->length()];
memcpy(buffer, this->data(), this->length());
- return new QuicReceivedPacket(buffer, this->length(), receipt_time(), true);
+ return new QuicReceivedPacket(buffer, this->length(), receipt_time(), true,
+ ttl(), ttl() >= 0);
}
ostream& operator<<(ostream& os, const QuicReceivedPacket& s) {
« no previous file with comments | « net/quic/core/quic_protocol.h ('k') | net/tools/quic/quic_packet_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698