Skip to content

Commit 2470e66

Browse files
authored
fix: search for router when sending packet (#76)
1 parent a968190 commit 2470e66

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/types/packet.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,15 @@ export function sendPacket(
261261
return edge.otherEnd(originId) === destinationId;
262262
});
263263
if (firstEdge === undefined) {
264-
firstEdge = originConnections[0];
264+
firstEdge = originConnections.find((edge) => {
265+
return isRouter(viewgraph.datagraph.getDevice(edge.otherEnd(originId)));
266+
});
267+
}
268+
if (firstEdge === undefined) {
269+
console.warn(
270+
"El dispositivo de origen no está conectado al destino o a un router.",
271+
);
272+
return;
265273
}
266274
packet.traverseEdge(firstEdge, originId);
267275
}

0 commit comments

Comments
 (0)