Skip to content

Commit 1576d51

Browse files
committed
packet loss phase start msg
1 parent 8d33b09 commit 1576d51

3 files changed

Lines changed: 19 additions & 11 deletions

File tree

src/engine/mod.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -355,13 +355,9 @@ impl TestEngine {
355355
cancel.clone(),
356356
)
357357
.await?;
358-
359-
event_tx
360-
.send(TestEvent::PhaseStarted {
361-
phase: Phase::PacketLoss,
362-
})
363-
.await
364-
.ok();
358+
// Note: PhaseStarted::PacketLoss is emitted from inside the upload function
359+
// the moment its tick loop ends, so the dashboard can switch immediately
360+
// without waiting for upload-task drain.
365361

366362
let mut experimental_udp = None;
367363
let mut udp_error = None;

src/engine/throughput.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,16 @@ pub async fn run_upload_with_loaded_latency(
335335
tokio::time::sleep(Duration::from_millis(200)).await;
336336
}
337337

338+
// Tick loop has ended — from the user's perspective the upload phase is over.
339+
// Announce the next phase now so the dashboard updates immediately, even though
340+
// the worker drain and latency probe await below may take a moment.
341+
event_tx
342+
.send(TestEvent::PhaseStarted {
343+
phase: Phase::PacketLoss,
344+
})
345+
.await
346+
.ok();
347+
338348
stop.store(true, Ordering::Relaxed);
339349
for h in handles {
340350
let _ = h.await;

src/tui/dashboard.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,12 @@ pub fn draw_dashboard(area: Rect, f: &mut Frame, state: &UiState) {
491491
udp_inner,
492492
);
493493
} else {
494-
f.render_widget(
495-
Paragraph::new("Packet loss probe starts after upload phase..."),
496-
udp_inner,
497-
);
494+
let msg = if state.phase == crate::model::Phase::PacketLoss {
495+
"Packet loss probe starting..."
496+
} else {
497+
"Packet loss probe starts after upload phase..."
498+
};
499+
f.render_widget(Paragraph::new(msg), udp_inner);
498500
}
499501

500502
// Network Information and Keyboard Shortcuts side-by-side

0 commit comments

Comments
 (0)