encoding: Optimized encoding of Interest and related data structures
Change-Id: I0609b40565835568e09c3cc0330db441fd9243b6
refs: #1172
diff --git a/src/helper/command-interest-generator.cpp b/src/helper/command-interest-generator.cpp
index c216680..006d440 100644
--- a/src/helper/command-interest-generator.cpp
+++ b/src/helper/command-interest-generator.cpp
@@ -28,8 +28,12 @@
usleep(1000); //Guarantee unqiueness of timestamp
timestamp = time::now();
}
-
- interest.getName().append(name::Component::fromNumber(timestamp)).append(name::Component::fromNumber(random::generateWord64()));
+
+ Name commandInterestName = interest.getName();
+ commandInterestName
+ .append(name::Component::fromNumber(timestamp))
+ .append(name::Component::fromNumber(random::generateWord64()));
+ interest.setName(commandInterestName);
if(certificateName == DEFAULT_CERTIFICATE_NAME)
m_keyChain.sign(interest);
@@ -45,8 +49,12 @@
int64_t timestamp = time::now() / 1000000;
if(timestamp <= m_lastTimestamp)
timestamp = m_lastTimestamp + 1;
-
- interest.getName().append(name::Component::fromNumber(timestamp)).append(name::Component::fromNumber(random::generateWord64()));
+
+ Name commandInterestName = interest.getName();
+ commandInterestName
+ .append(name::Component::fromNumber(timestamp))
+ .append(name::Component::fromNumber(random::generateWord64()));
+ interest.setName(commandInterestName);
m_keyChain.signByIdentity(interest, identity);