[ndnSIM] Can I create multiple PIT entries for one Interest?

大熊 浩也 okuma at stu.kobe-u.ac.jp
Sat Dec 21 21:31:59 PST 2019


Sorry for the late reply.
Thank you very much for your reply.

The error disappeared thanks to the advice.


However, Data is not transferred, probably because the pit entry was not 
created and inserted correctly.


The proof is as follows in "PIT match" of Forwarder :: onIncomingData.

pitMatches.begin () == pitMatches.end ()


I would like to know in detail how to check the PIT table.
Also, please let me know if there are any other reasons why "PIT match" 
is not successful.

Please check below for a portion of the modified Forwarder :: 
onIncomingInterest.

Best Wishes,
Hiroya Okuma
---------------------
void
Forwarder::onIncomingInterest(Face& inFace, const Interest& interest)
{
...// Divide file name and store in array "nameVec"
   shared_ptr<Interest> interestForPIT = make_shared<Interest>(interest);
   for (unsigned int i=0; i<nameVec.size(); i++){
     interestForPIT->setName(nameVec[i]);
     shared_ptr<pit::Entry> pitEntry = m_pit.insert(*interestForPIT).first;
     // detect duplicate Nonce
     int dnw = pitEntry->findNonce(interestForPIT->getNonce(), inFace);
     bool hasDuplicateNonce = (dnw != pit::DUPLICATE_NONCE_NONE) ||
                            m_deadNonceList.has(interestForPIT->getName(), interestForPIT->getNonce());
     if (hasDuplicateNonce) {
       // goto Interest loop pipeline
       this->onInterestLoop(inFace, *interestForPIT, pitEntry);
       return;
     }
     // cancel unsatisfy & straggler timer
     this->cancelUnsatisfyAndStragglerTimer(pitEntry);
     // is pending?
     const pit::InRecordCollection& inRecords = 
pitEntry->getInRecords();// InRecordCollection ← std::list< InRecord>
     bool isPending = inRecords.begin() != inRecords.end();
     if (!isPending) {
       if (m_csFromNdnSim == nullptr) {
         m_cs.find(*interestForPIT,
                   bind(&Forwarder::onContentStoreHit, this, 
ref(inFace), pitEntry, _1, _2),
                   bind(&Forwarder::onContentStoreMiss, this, 
ref(inFace), pitEntry, _1));
       }
       else {
         shared_ptr<Data> match = 
m_csFromNdnSim->Lookup(interestForPIT->shared_from_this());
         if (match != nullptr) {
           this->onContentStoreHit(inFace, pitEntry, *interestForPIT, 
*match);
         }
         else {
           this->onContentStoreMiss(inFace, pitEntry, *interestForPIT);
         }
       }
     }
     else {
       this->onContentStoreMiss(inFace, pitEntry, *interestForPIT);
     }
   }
}

On 2019/12/21 1:18, DJEMAA Adel wrote:
> Dear Okuma,
> A few days ago, I encountered a similar error while trying to get a copy of
> the interest packet in Forwarder.cpp (*onOutgoingInterest* method):
>   terminate called after throwing an instance of 'std::bad_weak_ptr'
>   what(): bad_weak_ptr
> So after several attempts, i changed the instantiation of Interest object
> like that:
> 
> *shared_ptr<Interest> interestForPIT = make_shared<Interest>(interest);*
> 
> According to your code, Before invoking: *m_pit.insert *method; y
> should instantiate another Interest object, like that:
> 
>    *shared_ptr<Interest> interest2 = interestForPIT;*
> 
>   * m_pit.insert(*interest2).first;*
> 
> Maybe this is not the optimal or the best method, but that solved my problem.
> 
> Hope that would help.
> 
> 
> Regards
> 
> 
> Le sam. 14 déc. 2019 à 22:41, DJEMAA Adel <a_djemaa at esi.dz> a écrit :
> 
>> Dear Okuma,
>> A few days ago, I encountered a similar error while trying to get a copy
>> of the interest packet in Forwarder.cpp (*onOutgoingInterest* method):
>>   terminate called after throwing an instance of 'std::bad_weak_ptr'
>>   what(): bad_weak_ptr
>> So after several attempts, i changed the instantiation of Interest object
>> like that:
>>
>> *shared_ptr<Interest> interestForPIT = make_shared<Interest>(interest);*
>>
>> According to your code, Before invoking: *m_pit.insert *method; y should instantiate another Interest object, like that:
>>
>>    *shared_ptr<Interest> interest2 = interestForPIT;*
>>
>>   * m_pit.insert(*interest2).first;*
>>
>> Maybe this is not the optimal or the best method, but that solved my problem.
>>
>> Hope that would help.
>>
>>
>> Regards
>>
>>
>>
>>
>>
>>
>> Le sam. 14 déc. 2019 à 09:36, Hiroya Okuma <okuma at stu.kobe-u.ac.jp> a
>> écrit :
>>
>>> Dear Lixia Zhang
>>>
>>> As you said, the router does not know the relationship between
>>> "/prefix/A" and "/prefix/A+B".  Therefore, I want to add a process to make
>>> the router divide Interest Name and create PIT entries for the number of
>>> requested files.  (For ease of division, it is assumed that each file names
>>> are the same size.)
>>>
>>> It is only necessary to temporarily create an Interest for creating PIT
>>> entries for multiple request file names.
>>>
>>> Currently, the onIncomingInterest method of the Forwarder class of ndnSIM
>>> is being modified.
>>> I think there are two ways.
>>>
>>> 1.Multiple request file names obtained by dividing are stored in an
>>> array, and processing for setting each file name in Interest and creating a
>>> PIT entry is repeated.
>>> → According to your advice, routers cannot set interest names
>>>
>>> 2.Prepare an instance of Interest class to create PIT entry in
>>> onIncomingInterest method (?)
>>> Example:
>>> void
>>> Forwarder::onIncomingInterest(Face& inFace, const Interest& interest)
>>> {
>>> ...// Divide file name and store in array "nameVec"
>>>   for (unsigned int i=0; i<nameVec.size(); i++){
>>>     Interest interestForPIT = interest;
>>>     interestForPIT.setName(nameVec[i]);
>>>     shared_ptr<pit::Entry> pitEntry = m_pit.insert(interestForPIT).first;
>>>     ...
>>>   }
>>> }
>>> → error
>>> terminate called after throwing an instance of 'std::bad_weak_ptr'
>>>   what(): bad_weak_ptr
>>>
>>> I don't have much experience with ndnSIM, so it may be a rudimentary
>>> question.
>>>
>>> Please let me know if there are any good methods other than the above two
>>> methods.
>>>
>>> Best Wishes,
>>>
>>> Hiroya Okuma
>>>
>>> 2019/12/14 12:46、Lixia Zhang <lixia at cs.ucla.edu>のメール:
>>>
>>>> In the above you developed an interesting scenario.
>>>> Here is my view: we need to clarify the assumption here.
>>>> Although NDN uses app names to fetch data, one needs to keep in mind
>>> that routers/forwarders do not understand the name semantics, they forward
>>> interests and data packets by matching the binary strings of the names.
>>>>
>>>> for example the prefixes /prefix/A, /prefix/B, and /prefix/A+B are
>>> independent ones; a router would not know their relations.
>>>> So a router wont be able to perform any function based on its semantic
>>> understanding of the name "/prefix/A/%FE%00/prefix/A+B/%FE%00"
>>>>
>>>> I believe you need to write your own application to do that
>>>
>>>
>>>
>>> _______________________________________________
>>> ndnSIM mailing list
>>> ndnSIM at lists.cs.ucla.edu
>>> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
>>>
>>
>>
>> --
>> Bien cordialement.
>> Mr DJAMA Adel.
>> Ecole Nationale Superieure d'Informatique - Oued smar, Alger, Algérie.
>>
> 
> 

-- 
********************************************
大熊 浩也 (Hiroya Okuma)
神戸大学 工学研究科 電気電子工学専攻
情報通信研究室所属
E-mail: okuma at stu.kobe-u.ac.jp
********************************************




More information about the ndnSIM mailing list