client select was reusing fd_set; use FD_COPY to copy fd_sets
This commit is contained in:
parent
955db52cda
commit
7b63081921
@ -1218,7 +1218,7 @@ void iperf_run_server(struct iperf_test *test)
|
|||||||
|
|
||||||
while(test->default_settings->state != TEST_END)
|
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_sec = 50;
|
||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
|
|
||||||
@ -1341,6 +1341,7 @@ void iperf_run_client(struct iperf_test *test)
|
|||||||
int64_t delayus, adjustus, dtargus, remaining, min;
|
int64_t delayus, adjustus, dtargus, remaining, min;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
int ret=0;
|
int ret=0;
|
||||||
|
|
||||||
tv.tv_sec = 15; // timeout interval in seconds
|
tv.tv_sec = 15; // timeout interval in seconds
|
||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
|
|
||||||
@ -1376,14 +1377,15 @@ void iperf_run_client(struct iperf_test *test)
|
|||||||
// send data till the timer expires
|
// send data till the timer expires
|
||||||
while(!timer->expired(timer))
|
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)
|
if(ret < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sp= test->streams;
|
sp= test->streams;
|
||||||
for(i=0;i<test->num_streams;i++)
|
for(i=0;i<test->num_streams;i++)
|
||||||
{
|
{
|
||||||
if(FD_ISSET(sp->socket, &test->write_set))
|
if(FD_ISSET(sp->socket, &test->temp_set))
|
||||||
{
|
{
|
||||||
result+= sp->snd(sp);
|
result+= sp->snd(sp);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user