[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Replicator



Hello All.

I gave up using get-mcast-tree to find out intermediate nodes of a multicast
tree.  Instead, after all the receivers join group and after sufficient amount
of time, I call " set r [$node($i) getRepByGroup $group" for all nodes and
consider the node is in the tree if { $r != "" && [$r is-active]}.  This works
fine only one time.  However, I encounter problem when I do following

# All the agents are created before this loop

set time 0
for { set i 0 } { $i < [lindex $argv 1[ } { incr i } { 
	$ns at $time
 	--- get random source id : src
	--- attach $node($src) source_agent

	incr time
	$ns at $time
	--- get random receiver ids : rid
	--- attach $node($rid) receiver_agents

	incr time
	$ns at $time
	--- source agent start

	incr time
	$ns at $time
	--- receivers join group
	
	set time [expr $time + 10]
	$ns at $time
	foreach n [array name node] {
		set r [$n getRepByGroup $group]
		if { $r != "" && [$r is-active] } {
			#intermediate node found
			lappend inter_nodes $n
		}
	}


	--- gather statistics and compute average, worst and best cases

	incr time
	$ns at $time
	--- stop source agent
	--- all receivers leave the group
	--- detach all the agents from nodes
	--- set inter_nodes ""

	incr time
}


When the loop runs for the second time, some nodes contain 2 active replicators
for the group and 3 active replicators for the third time and so on.  When there
are more than one replicators [$r is-active] generates an error which I can
solve.  My question is that when receivers leave the group, shouldn't
replicator for the group become inactive or removed?  

In addition, it seems like multiple active replicators for a group per a node
really slows down the simulation process as well.


Thanks in advance

-James Kwon