Fix reconnect stale keys and TUI status rendering
ci / test (push) Has been cancelled
ci / fuzz-smoke (push) Has been cancelled
ci / windows-client (push) Has been cancelled
ci / package-release (linux-x86_64, ubuntu-latest) (push) Has been cancelled
ci / package-release (macos-aarch64, macos-14) (push) Has been cancelled
ci / package-release (macos-x86_64, macos-13) (push) Has been cancelled
ci / package-release (windows-x86_64, windows-latest) (push) Has been cancelled
ci / remote-bench (push) Has been cancelled
ci / test (push) Has been cancelled
ci / fuzz-smoke (push) Has been cancelled
ci / windows-client (push) Has been cancelled
ci / package-release (linux-x86_64, ubuntu-latest) (push) Has been cancelled
ci / package-release (macos-aarch64, macos-14) (push) Has been cancelled
ci / package-release (macos-x86_64, macos-13) (push) Has been cancelled
ci / package-release (windows-x86_64, windows-latest) (push) Has been cancelled
ci / remote-bench (push) Has been cancelled
This commit is contained in:
@@ -620,6 +620,48 @@ fn disconnected_client_times_out_and_gets_reject() {
|
||||
assert_eq!(reject.reason, "unknown client");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn known_client_with_stale_key_id_gets_reject_not_timeout() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let port = free_udp_port();
|
||||
let config = write_server_config(&dir, port);
|
||||
let mut server = start_server(&dir, &config);
|
||||
let (_bootstrap, ok) = {
|
||||
let (_socket, bootstrap, ok) = direct_attach(&config, port, "read-write");
|
||||
(bootstrap, ok)
|
||||
};
|
||||
let socket = UdpSocket::bind("127.0.0.1:0").unwrap();
|
||||
socket
|
||||
.set_read_timeout(Some(Duration::from_secs(2)))
|
||||
.unwrap();
|
||||
let stale_key = crypto::random_32();
|
||||
let packet = protocol::encode_encrypted(
|
||||
PacketKind::Ping,
|
||||
ok.client_id,
|
||||
99,
|
||||
0,
|
||||
&stale_key,
|
||||
CLIENT_TO_SERVER,
|
||||
b"",
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
socket
|
||||
.send_to(&packet, format!("127.0.0.1:{port}"))
|
||||
.unwrap();
|
||||
let mut buf = [0u8; 65535];
|
||||
let (n, _) = socket.recv_from(&mut buf).unwrap();
|
||||
let packet = protocol::decode(&buf[..n]).unwrap();
|
||||
let reject: AttachReject = protocol::from_body(&packet.body).unwrap();
|
||||
|
||||
let _ = server.kill();
|
||||
let _ = server.wait();
|
||||
|
||||
assert_eq!(packet.header.kind, PacketKind::AttachReject);
|
||||
assert_eq!(packet.header.conn_id, ok.client_id);
|
||||
assert_eq!(reject.reason, "unknown client");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn local_attach_only_smoke() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
@@ -1525,8 +1567,8 @@ fn resume_snapshot_preserves_alternate_screen_mode() {
|
||||
|
||||
assert!(resume_frame.snapshot);
|
||||
assert!(
|
||||
resume_frame.bytes.starts_with(b"\x1b[?1049h"),
|
||||
"snapshot did not enter alternate screen first: {:?}",
|
||||
resume_frame.bytes.starts_with(b"\x1b[?1049h\x1b[H\x1b[2J"),
|
||||
"snapshot did not enter and clear alternate screen first: {:?}",
|
||||
String::from_utf8_lossy(&resume_frame.bytes)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user