[ndnSIM] Ways to create new Interest object

Mudasir Qazi mudasirqazi00 at gmail.com
Wed Apr 4 08:17:07 PDT 2018


@Spyridon (Spyros) Mastorakis, I did not know the actual problem at that
time that's why I was unable to mention it. The answer of the @Junxiao Shi
solved that  specific error for me. Thanks to both of you for response and
help. I want to know should I still be creating new nonce for interest?

I'm getting another problem which I think is related to previous one, let
me explain it below:

shared_ptr<lp::NextHopFaceIdTag> nextHopTag =

Above line in onContentStoreMiss method in Forwarder.cpp always returns
*nullptr* making if (nextHopTag != nullptr) returns false at very next
line. So the execution does not goes inside this if-block. This way,
following statement inside the if-block

this->onOutgoingInterest(pitEntry, *nextHopFace, interest);

never executed and hence the Interest is not flooded to neighboring nodes.
Why the nextHopTag is null in Interest? What is the solution of it? Am I
missing something? Please help.

On 4 April 2018 at 05:35, Junxiao Shi <shijunxiao at email.arizona.edu> wrote:

> Hi Mudasir
>> *Method #2:* Creating Interest from an existing Interest like this:
>> const Name& tempName = "---";
>> Interest tempInterest = Interest(interest.wireEncode());
>> tempInterest.setName(tempName);
>> *My problem:*
>> Now, I know Method#2 is the official way that meets my requirements. But
>> the thing is, when I use method#2 it gives error on *findOrInsert*
>> method in *pit.cpp* file and I don't understand its reason.
>> auto entry = make_shared<Entry>(interest);
> https://github.com/named-data/ndn-cxx/blob/ebfe4a207f658a77b5249cda4bd0bc
> 35ede82066/src/interest.hpp#L64-L65
> In certain contexts that use Interest::shared_from_this(), Interest must
> be created using `make_shared`. Otherwise, .shared_from_this() will trigger
> undefined behavior.
> PIT is one of those contexts. So are many other places in NFD.
> Thus, you need:
> auto tempInterest = std::make_shared<Interest>(interest.wireEncode());
> tempInterest->setName(tempName);
> Yours, Junxiao

Mudasir Qazi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20180404/ae393ca8/attachment.html>

More information about the ndnSIM mailing list