From 8c2de4973cbf00623fabcef801a90af971b1f9bb Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 26 Jan 2018 14:33:06 -0500 Subject: [PATCH] rollback --- libi2pd/LeaseSet.cpp | 7 +++---- libi2pd/LeaseSet.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libi2pd/LeaseSet.cpp b/libi2pd/LeaseSet.cpp index e763912f..f2355930 100644 --- a/libi2pd/LeaseSet.cpp +++ b/libi2pd/LeaseSet.cpp @@ -135,7 +135,7 @@ namespace data } } - uint64_t LeaseSet::ExtractTimestamp (const uint8_t * buf, size_t len, uint8_t& num) const + uint64_t LeaseSet::ExtractTimestamp (const uint8_t * buf, size_t len) const { if (!m_Identity) return 0; size_t size = m_Identity->GetFullLen (); @@ -143,7 +143,7 @@ namespace data size += 256; // encryption key size += m_Identity->GetSigningPublicKeyLen (); // unused signing key if (size > len) return 0; - num = buf[size]; + uint8_t num = buf[size]; size++; // num if (size + num*LEASE_SIZE > len) return 0; uint64_t timestamp= 0 ; @@ -160,8 +160,7 @@ namespace data bool LeaseSet::IsNewer (const uint8_t * buf, size_t len) const { - uint8_t num1, num2; - return ExtractTimestamp (buf, len, num2) > ExtractTimestamp (m_Buffer, m_BufferLen, num1) || num2 < num1; // some lease might be deleted + return ExtractTimestamp (buf, len) > ExtractTimestamp (m_Buffer, m_BufferLen); } bool LeaseSet::ExpiresSoon(const uint64_t dlt, const uint64_t fudge) const diff --git a/libi2pd/LeaseSet.h b/libi2pd/LeaseSet.h index 69b4e2fc..fa24df2f 100644 --- a/libi2pd/LeaseSet.h +++ b/libi2pd/LeaseSet.h @@ -82,7 +82,7 @@ namespace data private: void ReadFromBuffer (bool readIdentity = true, bool verifySignature = true); - uint64_t ExtractTimestamp (const uint8_t * buf, size_t len, uint8_t& num) const; // returns max expiration time, num is number of leases + uint64_t ExtractTimestamp (const uint8_t * buf, size_t len) const; // returns max expiration time private: