<html><head></head><body><div class="ydpb56087c0yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div dir="ltr" data-setdir="false"> <div>Hi,<br>I am writing a forwarding strategy for vehicular networks. My proposed strategy involve inducing delay in sending Interest packets that are either locally generated or received ones. I am trying to impose delay in calling <b>sendInterest()</b> in <b>myNewStrategy::afterReceiveInterest() </b>as follow (in a simple form):<br><br>ns3::Time time = ns3::MilliSeconds (50);<br>ns3::EventId eId = ns3::Simulator::<b>Schedule</b> (time, &fw::myNewStrategy::<b>sendInterest</b>, <b>this</b>, <b>pitEntry</b>,<b>FaceEndpoint(outFace,0)</b>, <b>interest</b>);<br><br>but I get the the bad weak pointer:<br><b>terminate called after throwing an instance of 'std::bad_weak_ptr'<br>  what():  bad_weak_ptr</b><br><br>However, when I call sendInterest() without scheduling, it work fines:<br><b>this</b>-><b>sendInterest</b>(pitEntry,FaceEndpoint(outFace,0), interest);<br><br>What I can understnd from reading about the error. It is an exception that is thrown by shared pointer twhen a weak pointer refers to an already deleted object. In sendInterest()  declaration,  pitEntry paramtere that is only in form of shared pointer. I tried to use pitEnty in weak pointer form with checking its expirey but I got same error.Also, I am sure the delay time for sendInterest() is less than pitEnrty's expiry timer that invoke rejectPendingInterest() to erase the PIT entry.<br><br>I tried using debugging tool "gdb" to figure out what ipart of code is causing that, but it seems undefined behavior.<br><br>Could you help me in the following:<br><br>1. Did I do a mistake in calling sendInterest() and passing parameters to the scheduler function? if so, what is the correct way?<br>2. Why scheduling sendInterest() issues this kind of error? does that impact of parameters scope? Does it need to pass parameters as shared pointers, if so, does that will impose redeclare/define other methods such as onOutgoingInterest in forwarder.cpp to accept shared pointer paramteres?<br>3. I hope if anyone can share here a code snippet or links regarding this issue.<br>4. Is this error can be under this waring as I can read it in ndnSIM documentation:<br>The strategy must not retain shared_ptr<pit::Entry>, otherwise undefined behavior may occur. However, the strategy is allowed to store weak_ptr<pit::Entry>.  <br><br>Your assistance would be higly appreceiated.<br> <br>Regards<br>Hussein</div><div><br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><div><br></div></div><div><br></div><div class="ydpb56087c0signature"><div style="font-family:Helvetica, Arial, sans-serif;font-size:16px;"><div style="font-size:16px;">            </div><div style="font-family:arial, helvetica, clean, sans-serif;"><font size="2"><b>Best regards,</b></font></div><div style="font-family:arial, helvetica, clean, sans-serif;"><b><font size="2"><br></font></b></div><div style="font-family:arial, helvetica, clean, sans-serif;"><b><font size="2">Hussein Al-Omaisi</font></b></div><div><font size="2"><font face="arial, helvetica, clean, sans-serif">Ph.D.</font><span style="font-family:arial, helvetica, clean, sans-serif;"> Student</span></font></div><div style="font-family:arial, helvetica, clean, sans-serif;"><font size="2" color="#808080">Network and Communication Technology Research Group (NCT LAB)</font></div><div style="font-family:arial, helvetica, clean, sans-serif;"><span><span style="font-family:arial, sans-serif;"><font style="background-color: inherit;" size="2" color="#808080">Faculty of Information Science and Technology (FTSM)</font></span></span></div><div><font size="2" face="arial, sans-serif" color="#808080">The National University of Malaysia (UKM)</font></div><div><font size="2" face="arial, sans-serif" color="#808080"> <span><span style="font-family:arial, sans-serif;">43600 Bangi, Selangor</span></span></font></div><div><font face="arial, sans-serif"><font size="2" color="#808080">Malaysia</font><br></font><font size="2" face="arial, helvetica, clean, sans-serif">Mobile +60172433904</font></div><div><font size="2" face="arial, helvetica, clean, sans-serif">WhatsApp +967 771607828</font></div><div><font size="2" face="arial, helvetica, clean, sans-serif">Email:</font></div><div><font size="2" face="arial, helvetica, clean, sans-serif">            alomaisi2004@yahoo.com<br></font></div><div><font size="2" face="arial, helvetica, clean, sans-serif">            p92824@siswa.ukm.edu.my</font></div></div></div></div></div></body></html>