face: Fixing face registration protocol by ensuring uniqueness of each command interest
This commit also introduces a new helper ndn::random::generateWord32()
to generate random 32-bit integer (currently using CryptoPP functions).
Change-Id: I7bd32875cbdd98eea793aa5d8270f8091b7c1a6b
diff --git a/src/interest.cpp b/src/interest.cpp
index 7f2ddc1..6c030dc 100644
--- a/src/interest.cpp
+++ b/src/interest.cpp
@@ -5,23 +5,9 @@
* See COPYING for copyright and distribution information.
*/
-#include <stdexcept>
#include "common.hpp"
#include "interest.hpp"
-
-#if __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wreorder"
-#pragma clang diagnostic ignored "-Wtautological-compare"
-#pragma clang diagnostic ignored "-Wunused-variable"
-#pragma clang diagnostic ignored "-Wunused-function"
-#elif __GNUC__
-#pragma GCC diagnostic ignored "-Wreorder"
-#pragma GCC diagnostic ignored "-Wunused-variable"
-#pragma GCC diagnostic ignored "-Wunused-function"
-#endif
-
-#include <cryptopp/osrng.h>
+#include "util/random.hpp"
using namespace std;
@@ -32,10 +18,8 @@
const uint32_t&
Interest::getNonce() const
{
- static CryptoPP::AutoSeededRandomPool rng;
-
if (nonce_ == 0)
- nonce_ = rng.GenerateWord32();
+ nonce_ = random::generateWord32();
return nonce_;
}