Made it easier to configure how many packets that should be received. Reduced the total amount of packets from 10 to 8 to make the test complete faster.
This commit is contained in:
parent
7987a6dac7
commit
6e7beb93cb
|
@ -398,6 +398,7 @@ booted = new Array();
|
|||
received = new Array();
|
||||
hops = new Array();
|
||||
nrNodes = 20;
|
||||
toReceive = 8;
|
||||
total_received = 0;
|
||||
total_lost = 0;
|
||||
total_hops = 0;
|
||||
|
@ -411,7 +412,10 @@ total_latency = 0;
|
|||
nodes_starting = true;
|
||||
for(i = 1; i <= nrNodes; i++) {
|
||||
booted[i] = false;
|
||||
received[i] = "__________";
|
||||
received[i] = '';
|
||||
for(var j = 0; j < toReceive; j++) {
|
||||
received[i] += '_';
|
||||
}
|
||||
hops[i] = received[i];
|
||||
}
|
||||
|
||||
|
@ -495,20 +499,20 @@ while(true) {
|
|||
dups++;
|
||||
}
|
||||
received[source] = received[source].substr(0, seqno) + dups +
|
||||
received[source].substr(seqno + 1, 10 - seqno);
|
||||
received[source].substr(seqno + 1, toReceive - seqno);
|
||||
|
||||
if(hop > 9) {
|
||||
hop = "+";
|
||||
}
|
||||
hops[source] = hops[source].substr(0, seqno) + hop +
|
||||
hops[source].substr(seqno + 1, 10 - seqno);
|
||||
hops[source].substr(seqno + 1, toReceive - seqno);
|
||||
|
||||
total_received++;
|
||||
total_hops += hop;
|
||||
|
||||
print_stats();
|
||||
}
|
||||
/* Signal OK if all nodes have reported 10 messages. */
|
||||
/* Signal OK if all nodes have reported toReceive messages. */
|
||||
num_reported = 0;
|
||||
for(i = 1; i <= nrNodes; i++) {
|
||||
if(i != sink) {
|
||||
|
|
Loading…
Reference in a new issue