[ndnSIM] Error while calling applications public member functions from scenario

Alex Afanasyev aa at CS.UCLA.EDU
Sun Aug 14 13:53:31 PDT 2016


> On Aug 14, 2016, at 12:14 PM, Junxiao Shi <shijunxiao at email.arizona.edu> wrote:
> 
> Hi Sabet
> 
> This usually occurs when you are trying to send a packet when processing a packet. You need a io.post in real application or ns3::Simulator::ScheduleNow in simulated application *somewhere*.
> 
> Yours, Junxiao
> 
> 
> On Aug 13, 2016 10:37 PM, "Muhammad Hosain Abdollahi Sabet" <mhasabet at gmail.com <mailto:mhasabet at gmail.com>> wrote:
> Hi,
> 
> I have a custom application "CustomApp". I have put SendInterest() in public so I can call it from scenario, for testing purposes. With this snap:
> 
>   ndn::AppHelper app1("CustomApp");
>   ApplicationContainer appCont = app1.Install(ConsNode);
> 
>   Ptr<CustomApp> app1ptr = DynamicCast<CustomApp>(appCont.Get(0));
>   app1ptr->SendInterest();

As Junxiao already pointed out, you cannot do this.  One of the reasons is that this code in main() function merely sets up the simulation.  The installed applications is "logically" installed on the node, and it doesn't necessarily has to start at the beginning of the simulation (it is just an accident that in your simulation it does, as you used the default start/stop times).

I would recommend checking the example applications, e.g., http://ndnsim.net/2.1/applications.html#customer-example <http://ndnsim.net/2.1/applications.html#customer-example>. You need two things,
- initiate application tasks only after StartApplication is called
- schedule send interest operation, not invoke it directly

--
Alex

> 
> I'm getting:
> 
> Command ['.../ns-3/build/scratch/simple-custom-app'] terminated with signal SIGSEGV. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").
> 
> which buy following gdb(insight) I end up :
> 
> BOOST_ASSERT_MSG(!m_isExecuting, "cannot emit signal from a handler");
> 
>  It is from:
> https://github.com/named-data-ndnSIM/ndn-cxx/blob/master/src/util/signal-signal.hpp:224 <https://github.com/named-data-ndnSIM/ndn-cxx/blob/master/src/util/signal-signal.hpp:224>
> Branch: ndn-cxx.0.3.4-ndnSIM
> 
> I have tested app1ptr with some sample doing-nothing-but-LOG member function and it worked.
> 
> I appreciate it if you could help me on what is wrong.
> 
> Thanks,
> Sabet
> 
> 
> 
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu <mailto:ndnSIM at lists.cs.ucla.edu>
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim <http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim>
> 
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20160814/c574b14f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20160814/c574b14f/attachment.bin>


More information about the ndnSIM mailing list