Fixed bug where -R mode selected on a closed file.

Also added a debugging routine to dump an fd_set.
This commit is contained in:
Jef Poskanzer 2013-12-05 08:49:27 -08:00
parent e42991a717
commit a4c1383a77
3 changed files with 23 additions and 0 deletions

View File

@ -181,6 +181,7 @@ iperf_handle_message_server(struct iperf_test *test)
case TEST_START:
break;
case TEST_END:
test->done = 1;
cpu_util(test->cpu_util);
test->stats_callback(test);
SLIST_FOREACH(sp, &test->streams, streams) {

View File

@ -279,3 +279,23 @@ iperf_json_printf(const char *format, ...)
va_end(argp);
return o;
}
/* Debugging routine to dump out an fd_set. */
void
iperf_dump_fdset(FILE *fp, char *str, int nfds, fd_set *fds)
{
int fd;
int comma;
fprintf(fp, "%s: [", str);
comma = 0;
for (fd = 0; fd < nfds; ++fd) {
if (FD_ISSET(fd, fds)) {
if (comma)
fprintf(fp, ", ");
fprintf(fp, "%d", fd);
comma = 1;
}
}
fprintf(fp, "]\n");
}

View File

@ -30,4 +30,6 @@ char* get_system_info(void);
cJSON* iperf_json_printf(const char *format, ...);
void iperf_dump_fdset(FILE *fp, char *str, int nfds, fd_set *fds);
#endif