In an agent I would like to change the routing protocol agent of a
wireless node. I can successfully insert a new routing agent, but I
somehow get a segmentation fault from the old agent:
The following code is executed from the C++ agent (with tcl.evalf()):
set ragent_(0) [new Agent/OLSR 0]
$ns_ attach-agent $node_(0) $ragent_(0)
$ragent_(0) start
$node_(0) set ragent_ $ragent_(0)
foreach dumbagent [Agent/DumbAgent info instances] {
if { [$dumbagent id] == 0} { ;# note: dumbagent has been
modified to save the node id
$dumbagent close
$ns_ detach-agent $node_(0) $dumbagent
break
}}
delete $dumbagent
The new OLSR agent sucessfully starts, however, the old dumbagent seems
not be completely deleted (or detached). Here is the gdb output:
Program received signal SIGSEGV, Segmentation fault.
0x00000000004224fc in PortClassifier::classify ()
(gdb) bt
#0 0x00000000004224fc in PortClassifier::classify ()
#1 0x000000000041ca2d in Classifier::find ()
#2 0x000000000041cb74 in Classifier::recv ()
#3 0x00000000004f9d12 in DumbAgent::recv ()
#4 0x000000000041cba6 in Classifier::recv ()
#5 0x00000000004f9d12 in DumbAgent::recv ()
#6 0x000000000041cba6 in Classifier::recv ()
(...)
Thanks for your advice,
Ulrich