Skip to content

Commit f46d9f5

Browse files
committed
Adjusts idle timeout
1 parent b04245e commit f46d9f5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

2019/23/network.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,17 @@ class Network {
6161
let nat_packet;
6262
let last_nat_sent = [];
6363

64-
const IDLE_REST = 200;
64+
// Should be one more than 3, aka what our output size should be to consistute a packet
65+
const IDLE_RESET = 4;
6566

6667
// Some arbitrary number of loops to test if "idle"
67-
let idle = IDLE_REST;
68+
let idle = IDLE_RESET;
6869
while (true) {
6970
idle--;
7071
for (let nic of this.nics) {
7172
let outputs = nic.run();
7273
if (outputs.length === 3) {
73-
idle = IDLE_REST;
74+
idle = IDLE_RESET;
7475
let address = outputs.shift();
7576
let x = outputs.shift();
7677
let y = outputs.shift();
@@ -95,7 +96,7 @@ class Network {
9596

9697
// Clone the packet, otherwise, when NIC 0 consumes this packet it modifies this value
9798
last_nat_sent = [...nat_packet];
98-
idle = IDLE_REST;
99+
idle = IDLE_RESET;
99100
}
100101
}
101102
}

0 commit comments

Comments
 (0)