Sometimes iperf client's write_set fds are never cleared and this can cause
infinite loop. This situation can happen when write_set is not cleared but
test's state is not running because clear write_set is only done in running
state. This patch adds clear write_set fds if test state is TEST_END and th
ere is not cleared write_fds and this can prevent infinite loop.
Change-Id: I3329fc1fa2454793ab2dfcd16eab177294fe3a31
Signed-off-by: EunBong Song <eunb.song@samsung.com>
if (iperf_recv(test, &read_set) < 0) {
return -1;
}
+ } else if (test->state == TEST_END) {
+ //clear write_set for preventing infinite loop
+ SLIST_FOREACH(sp, &test->streams, streams)
+ if (FD_ISSET(sp->socket, &test->write_set)) {
+ FD_CLR(sp->socket, &test->write_set);
+ }
}
}