From 7b6308192199241de10d3b907872a7b84502e7ba Mon Sep 17 00:00:00 2001 From: Jon Dugan Date: Tue, 21 Jul 2009 20:16:09 +0000 Subject: [PATCH] client select was reusing fd_set; use FD_COPY to copy fd_sets --- src/iperf_api.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/iperf_api.c b/src/iperf_api.c index b8d09c4..ba3fff5 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -1218,7 +1218,7 @@ void iperf_run_server(struct iperf_test *test) while(test->default_settings->state != TEST_END) { - memcpy(&test->temp_set, &test->read_set,sizeof(test->temp_set)); + FD_COPY(&test->read_set, &test->temp_set); tv.tv_sec = 50; tv.tv_usec = 0; @@ -1341,6 +1341,7 @@ void iperf_run_client(struct iperf_test *test) int64_t delayus, adjustus, dtargus, remaining, min; struct timeval tv; int ret=0; + tv.tv_sec = 15; // timeout interval in seconds tv.tv_usec = 0; @@ -1376,14 +1377,15 @@ void iperf_run_client(struct iperf_test *test) // send data till the timer expires while(!timer->expired(timer)) { - ret = select(test->max_fd+1, NULL, &test->write_set, NULL, &tv); + FD_COPY(&test->write_set, &test->temp_set); + ret = select(test->max_fd+1, NULL, &test->temp_set, NULL, &tv); if(ret < 0) continue; sp= test->streams; for(i=0;inum_streams;i++) { - if(FD_ISSET(sp->socket, &test->write_set)) + if(FD_ISSET(sp->socket, &test->temp_set)) { result+= sp->snd(sp);