1
1

Make the server more tolerant of most types of errors encountered

during tests.

We used to exit if 5 consecutive errors were encountered.  Instead,
only exit if certain types of fatal errors happen.
Этот коммит содержится в:
Bruce A. Mah 2016-06-03 09:26:05 -07:00
родитель 4dcb275b5b
Коммит b7ab2b4b25
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4984910A8CAAEE8A
2 изменённых файлов: 9 добавлений и 12 удалений

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

@ -440,11 +440,11 @@ iperf_run_server(struct iperf_test *test)
if (test->affinity != -1) if (test->affinity != -1)
if (iperf_setaffinity(test, test->affinity) != 0) if (iperf_setaffinity(test, test->affinity) != 0)
return -1; return -2;
if (test->json_output) if (test->json_output)
if (iperf_json_start(test) < 0) if (iperf_json_start(test) < 0)
return -1; return -2;
if (test->json_output) { if (test->json_output) {
cJSON_AddItemToObject(test->json_start, "version", cJSON_CreateString(version)); cJSON_AddItemToObject(test->json_start, "version", cJSON_CreateString(version));
@ -458,7 +458,7 @@ iperf_run_server(struct iperf_test *test)
// Open socket and listen // Open socket and listen
if (iperf_server_listen(test) < 0) { if (iperf_server_listen(test) < 0) {
return -1; return -2;
} }
// Begin calculating CPU utilization // Begin calculating CPU utilization

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

@ -129,8 +129,6 @@ sigend_handler(int sig)
static int static int
run(struct iperf_test *test) run(struct iperf_test *test)
{ {
int consecutive_errors;
/* Termination signals. */ /* Termination signals. */
iperf_catch_sigend(sigend_handler); iperf_catch_sigend(sigend_handler);
if (setjmp(sigend_jmp_buf)) if (setjmp(sigend_jmp_buf))
@ -145,21 +143,20 @@ run(struct iperf_test *test)
iperf_errexit(test, "error - %s", iperf_strerror(i_errno)); iperf_errexit(test, "error - %s", iperf_strerror(i_errno));
} }
} }
consecutive_errors = 0;
if (iperf_create_pidfile(test) < 0) { if (iperf_create_pidfile(test) < 0) {
i_errno = IEPIDFILE; i_errno = IEPIDFILE;
iperf_errexit(test, "error - %s", iperf_strerror(i_errno)); iperf_errexit(test, "error - %s", iperf_strerror(i_errno));
} }
for (;;) { for (;;) {
if (iperf_run_server(test) < 0) { int rc;
rc = iperf_run_server(test);
if (rc < 0) {
iperf_err(test, "error - %s", iperf_strerror(i_errno)); iperf_err(test, "error - %s", iperf_strerror(i_errno));
++consecutive_errors; if (rc < -1) {
if (consecutive_errors >= 5) { iperf_errexit(test, "exiting");
iperf_errexit(test, "too many errors, exiting");
break; break;
} }
} else }
consecutive_errors = 0;
iperf_reset_test(test); iperf_reset_test(test);
if (iperf_get_test_one_off(test)) if (iperf_get_test_one_off(test))
break; break;