fix: report a user-requested stop as stopped rather than failed

Stopping a test shuts down the control socket, so iperf_run_client() returns
-1 with "unable to send control message ... Broken pipe". That is the
expected consequence of the stop, not a fault, but the bridge read the
negative return as a failure — so pressing STOP left the UI showing
"Error (exit 1)" above a broken-pipe message.

The bridge now consults its own g_stop flag before classifying the outcome,
and the distinction travels up as Iperf3Result.stopped so the status line can
say "Stopped". A stop is reported with exit code 0: the run ended the way the
user asked it to.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-26 19:03:59 +09:00
parent fb6ec3af37
commit 02a8ba9c18
7 changed files with 63 additions and 3 deletions
+7 -1
View File
@@ -251,8 +251,14 @@ static void iperf_cleanup_and_signal(JNIEnv *env,
retire_test();
free_argv(argv, argc);
/* A user-requested stop shuts down the control socket, so
* iperf_run_client() returns -1 with "Broken pipe" — expected, not a
* failure. Check g_stop so that path is reported as a stop, not an error. */
int user_stopped = stopped || g_stop;
g_stop = 0;
/* Signal result to Java */
if (stopped) {
if (user_stopped) {
signal_output(env, state, "[iPerf JNI] Test was stopped by user.\n");
} else if (ret < 0) {
char errbuf[256];