Bug #2318
closedDummyClientFace: setInterestFilter(InterestFilter, OnInterest) is not effective by itself
100%
Description
Snippet to reproduce:
#include <ndn-cxx/util/dummy-client-face.hpp>
#include <boost/asio.hpp>
using std::bind;
using std::shared_ptr;
using ndn::Name;
using ndn::Interest;
using ndn::util::DummyClientFace;
int
main()
{
boost::asio::io_service io;
shared_ptr<DummyClientFace> face = ndn::util::makeDummyClientFace(io, {false, true});
//face->setInterestFilter(Name("/"), bind([]{}), bind([]{}));
face->setInterestFilter(Name("/"),
bind([] (const Interest& interest) { std::cout << interest << std::endl; }, _2));
io.poll();
io.reset();
Interest interest("/A");
face->receive(interest);
io.poll();
io.reset();
return 0;
}
Expected: Interest is received by handler.
Actual: Interest is not received by handler.
Note: If the registerPrefix+setInterestFilter combination operation is uncommented, the handler can receive the Interest.
Updated by Junxiao Shi almost 10 years ago
- Blocks Feature #1999: Strategy for access router added
Updated by Alex Afanasyev almost 10 years ago
- Start date deleted (
12/22/2014)
I don't get how this can block anything. What you described as a bug is actually a legitimate behavior of Face class.
This can be considered as improvement of DummyFace, but I'm rejecting the fact that it blocks anything.
Updated by Junxiao Shi almost 10 years ago
- Subject changed from DummyClientFace: setInterestFilter(Name, OnInterest) is not effective by itself to DummyClientFace: setInterestFilter(InterestFilter, OnInterest) is not effective by itself
Face::setInterestFilter(InterestFilter, OnInterest)
API shouldn't rely on a prefix registration made from the same Face
.
Any Interest delivered by Transport that matches the InterestFilter should invoke OnInterest handler, regardless of whether a prefix registration exists.
This blocks #1999 because a test case needs to use this API.
Updated by Junxiao Shi almost 10 years ago
- Status changed from New to In Progress
- Assignee set to Junxiao Shi
- Estimated time set to 2.00 h
Updated by Junxiao Shi almost 10 years ago
- % Done changed from 0 to 20
Some investigation reveals that:
Face
won't connect toTransport
until sending the first packetDummyClientFace::receive
requires the Face to be connected toTransport
before a packet can be delivered
My solution is:
- add
Face::forceConnect
method which causesFace
to connect toTransport
- invoke
Face::forceConnect
inmakeDummyClientFace
Updated by Junxiao Shi almost 10 years ago
- Status changed from In Progress to Code review
- % Done changed from 20 to 100
Updated by Junxiao Shi almost 10 years ago
- Status changed from Code review to In Progress
- % Done changed from 100 to 50
I would suggest a different change. Instead of face being connected only on demand, we can only "resume" it on demand. In other words, we can always connect in the constructor (start async connection in the constructor). There is no harm done. When Interest is sent or prefix is registered, the transport needs to be resumed.
Agreed.
Updated by Junxiao Shi almost 10 years ago
- Status changed from In Progress to Code review
- % Done changed from 50 to 100
http://gerrit.named-data.net/1574 patchset 3 implements note-7 idea.
Updated by Junxiao Shi almost 10 years ago
- Status changed from Code review to Closed