face: Fixing bug with incorrect pausing of Face
Change-Id: I3f739a5aec8f12803ff1065a6ad17349e5b656ce
Refs: #1405
diff --git a/src/face.cpp b/src/face.cpp
index a8b59e9..b2e98d1 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -110,12 +110,12 @@
if (!m_transport->isConnected())
m_transport->connect(*m_ioService,
bind(&Face::onReceiveElement, this, _1));
- else if (!m_transport->isExpectingData())
- m_transport->resume();
shared_ptr<const Interest> interestToExpress(new Interest(interest));
- m_ioService->post(bind(&Face::asyncExpressInterest, this, interestToExpress, onData, onTimeout));
+ // If the same ioService thread, dispatch directly calls the method
+ m_ioService->dispatch(bind(&Face::asyncExpressInterest, this,
+ interestToExpress, onData, onTimeout));
return reinterpret_cast<const PendingInterestId*>(interestToExpress.get());
}
@@ -140,6 +140,9 @@
Face::asyncExpressInterest(const shared_ptr<const Interest>& interest,
const OnData& onData, const OnTimeout& onTimeout)
{
+ if (!m_transport->isExpectingData())
+ m_transport->resume();
+
m_pendingInterestTable.push_back(shared_ptr<PendingInterest>(new PendingInterest
(interest, onData, onTimeout)));