Only set sockets to non-blocking mode on the sending side of the
transfer. Note that the sender can either be the client or the server depending on whether --reverse is used. This fixes some problems with UDP transfers getting severely confused and (wrongly) complaining about packets arriving out of order. Related to issue #125.
Этот коммит содержится в:
родитель
e7841b0f92
Коммит
cbacc1d670
@ -381,9 +381,12 @@ iperf_run_client(struct iperf_test * test)
|
||||
if (startup) {
|
||||
startup = 0;
|
||||
|
||||
SLIST_FOREACH(sp, &test->streams, streams) {
|
||||
setnonblocking(sp->socket, 1);
|
||||
}
|
||||
// If the client is sending (normal mode) then set nonblocking sockets
|
||||
if (!test->reverse) {
|
||||
SLIST_FOREACH(sp, &test->streams, streams) {
|
||||
setnonblocking(sp->socket, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (test->reverse) {
|
||||
@ -406,9 +409,12 @@ iperf_run_client(struct iperf_test * test)
|
||||
(test->settings->bytes != 0 && test->bytes_sent >= test->settings->bytes) ||
|
||||
(test->settings->blocks != 0 && test->blocks_sent >= test->settings->blocks))) {
|
||||
|
||||
SLIST_FOREACH(sp, &test->streams, streams) {
|
||||
setnonblocking(sp->socket, 0);
|
||||
}
|
||||
// If the client is sending (normal mode) then undo nonblocking sockets
|
||||
if (!test->reverse) {
|
||||
SLIST_FOREACH(sp, &test->streams, streams) {
|
||||
setnonblocking(sp->socket, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Yes, done! Send TEST_END. */
|
||||
test->done = 1;
|
||||
|
@ -516,7 +516,10 @@ iperf_run_server(struct iperf_test *test)
|
||||
FD_SET(s, &test->read_set);
|
||||
if (s > test->max_fd) test->max_fd = s;
|
||||
|
||||
setnonblocking(s, 1);
|
||||
// If the server is sending (reverse mode) then set nonblocking sockets
|
||||
if (test->reverse) {
|
||||
setnonblocking(s, 1);
|
||||
}
|
||||
|
||||
streams_accepted++;
|
||||
if (test->on_new_stream)
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user