core: bound rendezvous_register with an 8s timeout (was hanging iOS)
reqwest::Client::new() has no default timeout, so a slow/unreachable rendezvous wedged IrohTransport.start() right after coming online — the transport never reached "bootstrapping"/"joined topic". This is what hung the iOS app (both the device and the simulator) while the macOS agent happened to be fast enough not to notice. Build a client with an 8s timeout and add a "transport ready; registering" log to pinpoint it. With the fix, the iPhone joins the gossip topic in seconds and clipboard syncs phone⇄Mac over iroh (verified on device + simulator). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -99,7 +99,12 @@ async fn rendezvous_register(server: &str, room: &str, my_id: &str) -> Vec<Endpo
|
||||
}
|
||||
let url = format!("{}/rendezvous/register", server.trim_end_matches('/'));
|
||||
let body = serde_json::json!({ "room": room, "id": my_id });
|
||||
let mut req = reqwest::Client::new().post(&url).json(&body);
|
||||
// Bounded — a stuck rendezvous must never wedge the transport.
|
||||
let client = reqwest::Client::builder()
|
||||
.timeout(std::time::Duration::from_secs(8))
|
||||
.build()
|
||||
.unwrap_or_default();
|
||||
let mut req = client.post(&url).json(&body);
|
||||
// Optional bearer token, matching the rendezvous's TETHER_RENDEZVOUS_TOKEN.
|
||||
if let Ok(token) = std::env::var("TETHER_RENDEZVOUS_TOKEN") {
|
||||
if !token.is_empty() {
|
||||
@@ -189,6 +194,7 @@ impl Transport for IrohTransport {
|
||||
});
|
||||
|
||||
// Bootstrap: env override (tests) + the rendezvous (zero-config).
|
||||
eprintln!("tethercore[iroh]: transport ready; registering with rendezvous {}", this.cfg.server);
|
||||
let mut boot = env_bootstrap_ids();
|
||||
boot.extend(rendezvous_register(&this.cfg.server, &this.cfg.room, &my_id).await);
|
||||
eprintln!("tethercore[iroh]: bootstrapping with {} peer(s)", boot.len());
|
||||
|
||||
Reference in New Issue
Block a user