aboutsummaryrefslogtreecommitdiff
path: root/src/iperf_client_api.c
diff options
context:
space:
mode:
authorsrgnk <sergey.n.nemov@gmail.com>2019-06-06 01:08:17 +0200
committerBruce A. Mah <bmah@es.net>2019-06-05 16:08:17 -0700
commit255a9c71109406f23ebf9d651ca3f265aa1058f5 (patch)
tree94460a69bb4ed4f53331e1e2c3c0c9c87304e2ed /src/iperf_client_api.c
parentfd46367fc4ddfc76b8056885ec7f7cae1e1db8b5 (diff)
downloadiperf3-255a9c71109406f23ebf9d651ca3f265aa1058f5.tar.gz
enh: Introduce iperf_set_test_logfile API function (#871)
To be able to set the test->outfile to a different file other than default if using libiperf API. Since logfile is now opened in iperf_parse_arguments() and this function may not be used if running iperf using API, define a dedicated function iperf_open_logfile() and move the opening of logfile into iperf_run_client() and iperf_run_server() to make sure logfile will be opened if iperf_parse_arguments() was not called.
Diffstat (limited to 'src/iperf_client_api.c')
-rw-r--r--src/iperf_client_api.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/iperf_client_api.c b/src/iperf_client_api.c
index 46c283b..20ea6fd 100644
--- a/src/iperf_client_api.c
+++ b/src/iperf_client_api.c
@@ -454,6 +454,10 @@ iperf_run_client(struct iperf_test * test)
struct timeval* timeout = NULL;
struct iperf_stream *sp;
+ if (test->logfile)
+ if (iperf_open_logfile(test) < 0)
+ return -1;
+
if (test->affinity != -1)
if (iperf_setaffinity(test, test->affinity) != 0)
return -1;