From a898ff8b8ed4fb51d21e9c7852ffaf360fdf02da Mon Sep 17 00:00:00 2001 From: "Bruce A. Mah" Date: Mon, 6 Jan 2014 12:18:21 -0800 Subject: [PATCH] If the client gets interrupted / signaled, dump JSON output. Issue: 132 (signal handler for API calls) --- src/iperf_api.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/iperf_api.c b/src/iperf_api.c index 2ceebd4..c540beb 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2013, The Regents of the University of California, + * Copyright (c) 2009-2014, The Regents of the University of California, * through Lawrence Berkeley National Laboratory (subject to receipt of any * required approvals from the U.S. Dept. of Energy). All rights reserved. * @@ -2322,6 +2322,9 @@ iperf_got_sigend(struct iperf_test *test) (void) Nwrite(test->ctrl_sck, (char*) &test->state, sizeof(signed char), Ptcp); } i_errno = (test->role == 'c') ? IECLIENTTERM : IESERVERTERM; + /* If the client, then dump JSON output if any */ + if (test->role == 'c') + iperf_client_end(test); iperf_errexit(test, "interrupt - %s", iperf_strerror(i_errno)); }