Currently turmoil will panic, if a packet is send to an ip address that does not exist,
since this will result in an invalid access to the index map in top.rs.
This does not mirror the behavior if tokio or std sockets and panicking seems too extrem,
especially since some applications may create such sockets, expecting errors instead of
panics.
Therefore it might be advantageous to return errors instead of panicking in World::send_message.
Example
This example will panic.
fn main() -> Result {
let mut sim = Builder::new().build();
sim.client("client", async move {
let _ = net::TcpStream::connect("192.168.30.1:80").await?;
Ok(())
});
sim.run()
}
thread 'main' panicked at 'IndexMap: key not found', ~/dev/turmoil/src/top.rs:221:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: JoinError::Panic(Id(1), ...)
Currently
turmoil
will panic, if a packet is send to an ip address that does not exist, since this will result in an invalid access to the index map intop.rs
.This does not mirror the behavior if
tokio
orstd
sockets and panicking seems too extrem, especially since some applications may create such sockets, expecting errors instead of panics.Therefore it might be advantageous to return errors instead of panicking in
World::send_message
.Example
This example will panic.