fix: harden OpenSim session readiness
Some checks failed
CI / rust-skia (Rust only) (push) Has been cancelled
CI / required (push) Has been cancelled

This commit is contained in:
2026-08-21 20:37:16 +02:00
parent db25a977b7
commit adf5165033
14 changed files with 503 additions and 67 deletions

View File

@@ -536,9 +536,18 @@ fn spawn_fake_server() -> FakeServer {
socket.send_to(&ack(sequence), client_endpoint).unwrap();
let mut handshake = RegionHandshakePacket::new_with_constructor().unwrap();
handshake.region_info.sim_name = b"Fake Region".to_vec();
let mut bytes = handshake.to_bytes_with_method().unwrap();
bytes[0] &= !(Helpers::MSG_RELIABLE | Helpers::MSG_ZEROCODED);
handshake.region_info.sim_name = b"Fake Region\0".to_vec();
handshake.region_info.water_height = 21.5;
handshake.region_info2.region_id = UUID::new_with_u_int64(99).unwrap();
let raw = handshake.to_bytes_with_method().unwrap();
let mut bytes = vec![0_u8; raw.len().saturating_mul(2).saturating_add(2)];
let length = Helpers::zero_encode(
Some(&raw),
i32::try_from(raw.len()).unwrap(),
Some(&mut bytes),
)
.unwrap();
bytes.truncate(usize::try_from(length).unwrap());
socket.send_to(&bytes, client_endpoint).unwrap();
loop {
@@ -833,6 +842,9 @@ fn fake_server_drives_circuit_handshake_ping_disable_and_disconnect_reasons() {
assert_eq!(sim.seed_capability(), Some(seed));
assert_eq!(sim.size_x, 512);
assert_eq!(sim.size_y, 256);
assert_eq!(sim.name, "Fake Region");
assert_eq!(sim.region_id, UUID::new_with_u_int64(99).unwrap());
assert_eq!(sim.water_height, 21.5);
wait_until(|| sim.handshake_complete());
assert_eq!(
server.reports.recv_timeout(Duration::from_secs(1)).unwrap(),