model+ndn.cxx+test: Finishing implementation of ApiFace (now timeouts are working as well)
Also, adding a basic test case to test ApiFace
Refs #1005 (http://redmine.named-data.net/)
diff --git a/examples/custom-apps/ndn-api-app.cc b/examples/custom-apps/ndn-api-app.cc
index 886a0b8..3346b52 100644
--- a/examples/custom-apps/ndn-api-app.cc
+++ b/examples/custom-apps/ndn-api-app.cc
@@ -77,7 +77,7 @@
void
ApiApp::StartApplication ()
{
- m_face = Create<ApiFace> (GetNode ());
+ m_face = CreateObject<ApiFace> (GetNode ());
Simulator::Schedule (Seconds (1), &::ns3::ndn::ApiApp::RequestData, this);
}
@@ -85,6 +85,9 @@
void
ApiApp::StopApplication ()
{
+ NS_LOG_FUNCTION (this);
+ m_face->Shutdown ();
+ m_face = 0;
}
} // namespace ndn
diff --git a/examples/ndn-simple-api.cc b/examples/ndn-simple-api.cc
index 587ca55..5fb4dd9 100644
--- a/examples/ndn-simple-api.cc
+++ b/examples/ndn-simple-api.cc
@@ -76,7 +76,8 @@
// Consumer
ndn::AppHelper consumerHelper ("ns3::ndn::ApiApp");
consumerHelper.SetPrefix ("/prefix");
- consumerHelper.Install (nodes.Get (0)); // first node
+ ApplicationContainer app = consumerHelper.Install (nodes.Get (0)); // first node
+ app.Stop (Seconds (10.0));
// Producer
ndn::AppHelper producerHelper ("ns3::ndn::Producer");