Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions crates/net/tests/tunnel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,13 @@ async fn without_an_answer_to_the_probes_the_relay_still_makes_it_type_2() {
assert!(!reach.udp, "{reach:?}");
assert!(side.tunnels.relay_connected());
assert_eq!(tunnel::nat_type(Some(&reach), true), 2);
// The relay goes away: nothing answers any more.
// The relay goes away: nothing answers any more. A relay that closes its connection says
// so at once (about 60 ms on an idle machine). When that close does not reach the endpoint
// (the server is torn down while it is being sent, which a loaded macOS runner does
// sometimes), the endpoint finds out from its QUIC connection, which gives up after the
// relay client's idle timeout of 35 s (iroh-relay, quic.rs). Wait for that, not for 10 s.
relay.stop().await;
let gone = tokio::time::timeout(Duration::from_secs(10), async {
let gone = tokio::time::timeout(Duration::from_secs(45), async {
while side.tunnels.relay_connected() {
tokio::time::sleep(Duration::from_millis(50)).await;
}
Expand Down
19 changes: 16 additions & 3 deletions crates/share-worker/tests/access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ mod real_window {
use std::time::{Duration, Instant};

use anyplay_share_worker::capture::{self, WindowTarget};
use anyplay_share_worker::mac::sck::SckSound;
use anyplay_share_worker::mac::sck::{self, SckSound};
use anyplay_share_worker::sound::SoundSource;

use super::{WORKER, screen_access};
Expand Down Expand Up @@ -228,8 +228,21 @@ mod real_window {
let deadline = Instant::now() + Duration::from_secs(20);
while Instant::now() < deadline {
if let Some(pid) = pid_of_calculator() {
// The window needs a moment to be drawn.
std::thread::sleep(Duration::from_secs(3));
// The window is drawn some time after the process exists: on a cold start of
// a loaded runner longer than the few seconds the worker looks for it. Wait
// until the system lists it (each try looks for a few seconds itself).
let target = WindowTarget {
window: None,
pids: vec![pid],
title_contains: String::new(),
};
let listed_by = Instant::now() + Duration::from_secs(60);
while sck::find_window(&target).is_err() {
assert!(
Instant::now() < listed_by,
"Calculator has no window after 60 s"
);
}
return Some(Calculator {
pid,
started_here,
Expand Down