Added PitEntry and make expressInterest use the PIT.
diff --git a/tests/test-get-async.cpp b/tests/test-get-async.cpp
index 62cc2e5..94f3455 100644
--- a/tests/test-get-async.cpp
+++ b/tests/test-get-async.cpp
@@ -17,14 +17,14 @@
class MyClosure : public Closure {
public:
MyClosure()
- : gotContent_(false)
+ : gotContentCount_(0)
{
}
virtual UpcallResult upcall(UpcallKind kind, UpcallInfo &upcallInfo)
{
if (kind == UPCALL_DATA || kind == UPCALL_DATA_UNVERIFIED) {
- gotContent_ = true;
+ ++gotContentCount_;
cout << "Got data packet with name " << upcallInfo.getData()->getName().to_uri() << endl;
for (unsigned int i = 0; i < upcallInfo.getData()->getContent().size(); ++i)
cout << upcallInfo.getData()->getContent()[i];
@@ -36,7 +36,7 @@
return CLOSURE_RESULT_OK;
}
- bool gotContent_;
+ int gotContentCount_;
};
int main(int argc, char** argv)
@@ -44,10 +44,18 @@
try {
MyClosure closure;
Face face("E.hub.ndn.ucla.edu");
- face.expressInterest(Name("/ndn/ucla.edu/apps/ndn-js-test/hello.txt/level2/%FD%05%0B%16%7D%95%0E"), &closure);
+ Name name1("/ndn/ucla.edu/apps/ndn-js-test/hello.txt/level2/%FD%05%0B%16%7D%95%0E");
+ cout << "Express name " << name1.toUri() << endl;
+ face.expressInterest(name1, &closure);
+#if 0
+ Name name2("/ndn/ucla.edu/apps/lwndn-test/howdy.txt/%FD%05%05%E8%0C%CE%1D");
+ cout << "Express name " << name2.toUri() << endl;
+ face.expressInterest(name2, &closure);
+#endif
+
// The main event loop.
- while (!closure.gotContent_) {
+ while (closure.gotContentCount_ < 1) {
face.processEvents();
// We need to sleep for a few milliseconds so we don't use 100% of the CPU.
usleep(10000);