1
1

Fix: Avoid spamming stdout (and JSON output) with a warning.

Fixes #1223.
Этот коммит содержится в:
Bruce A. Mah 2021-11-08 16:35:37 -08:00
родитель a8e0787764
Коммит a071a8c8bd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4984910A8CAAEE8A
2 изменённых файлов: 12 добавлений и 6 удалений

Просмотреть файл

@ -1,5 +1,5 @@
/* /*
* iperf, Copyright (c) 2014-2020, The Regents of the University of * iperf, Copyright (c) 2014-2021, The Regents of the University of
* California, through Lawrence Berkeley National Laboratory (subject * California, through Lawrence Berkeley National Laboratory (subject
* to receipt of any required approvals from the U.S. Dept. of * to receipt of any required approvals from the U.S. Dept. of
* Energy). All rights reserved. * Energy). All rights reserved.
@ -60,6 +60,8 @@ typedef uint64_t iperf_size_t;
#define DEFAULT_NO_MSG_RCVD_TIMEOUT 120000 #define DEFAULT_NO_MSG_RCVD_TIMEOUT 120000
#define MIN_NO_MSG_RCVD_TIMEOUT 100 #define MIN_NO_MSG_RCVD_TIMEOUT 100
#define WARN_STR_LEN 128
/* short option equivalents, used to support options that only have long form */ /* short option equivalents, used to support options that only have long form */
#define OPT_SCTP 1 #define OPT_SCTP 1
#define OPT_LOGFILE 2 #define OPT_LOGFILE 2

Просмотреть файл

@ -1,5 +1,5 @@
/* /*
* iperf, Copyright (c) 2014-2020, The Regents of the University of * iperf, Copyright (c) 2014-2021, The Regents of the University of
* California, through Lawrence Berkeley National Laboratory (subject * California, through Lawrence Berkeley National Laboratory (subject
* to receipt of any required approvals from the U.S. Dept. of * to receipt of any required approvals from the U.S. Dept. of
* Energy). All rights reserved. * Energy). All rights reserved.
@ -403,9 +403,11 @@ iperf_udp_accept(struct iperf_test *test)
*/ */
if (rc > 0) { if (rc > 0) {
if (test->settings->socket_bufsize == 0) { if (test->settings->socket_bufsize == 0) {
char str[WARN_STR_LEN];
int bufsize = test->settings->blksize + UDP_BUFFER_EXTRA; int bufsize = test->settings->blksize + UDP_BUFFER_EXTRA;
printf("Increasing socket buffer size to %d\n", snprintf(str, sizeof(str), "Increasing socket buffer size to %d",
bufsize); bufsize);
warning(str);
test->settings->socket_bufsize = bufsize; test->settings->socket_bufsize = bufsize;
rc = iperf_udp_buffercheck(test, s); rc = iperf_udp_buffercheck(test, s);
if (rc < 0) if (rc < 0)
@ -515,9 +517,11 @@ iperf_udp_connect(struct iperf_test *test)
*/ */
if (rc > 0) { if (rc > 0) {
if (test->settings->socket_bufsize == 0) { if (test->settings->socket_bufsize == 0) {
char str[WARN_STR_LEN];
int bufsize = test->settings->blksize + UDP_BUFFER_EXTRA; int bufsize = test->settings->blksize + UDP_BUFFER_EXTRA;
printf("Increasing socket buffer size to %d\n", snprintf(str, sizeof(str), "Increasing socket buffer size to %d",
bufsize); bufsize);
warning(str);
test->settings->socket_bufsize = bufsize; test->settings->socket_bufsize = bufsize;
rc = iperf_udp_buffercheck(test, s); rc = iperf_udp_buffercheck(test, s);
if (rc < 0) if (rc < 0)