1
1

Fixed a bug that caused an error at results display.

Этот коммит содержится в:
sethdelliott 2010-06-23 21:34:07 +00:00
родитель 873952e31c
Коммит 7fa9f68fd5
7 изменённых файлов: 21 добавлений и 35 удалений

Просмотреть файл

@ -80,7 +80,7 @@ struct iperf_stream
* stream can have a pointer to this
*/
int packet_count;
int stream_id; /* stream identity for UDP mode */
uint64_t stream_id; /* stream identity for UDP mode */
double jitter;
double prev_transit;
int outoforder_packets;
@ -171,7 +171,6 @@ struct param_exchange
{
int state;
int protocol;
int stream_id;
int num_streams;
int reverse;
int blksize;

Просмотреть файл

@ -412,11 +412,11 @@ Display(struct iperf_test * test)
while (n != NULL) {
if (test->role == 'c') {
printf("position-%d\tsp=%d\tsocket=%d\tMbytes sent=%u\n",
count++, (int) n, n->socket, (uint) (n->result->bytes_sent / (float)MB));
printf("position-%d\tsp=%llu\tsocket=%d\tMbytes sent=%u\n",
count++, (uint64_t) n, n->socket, (unsigned int) (n->result->bytes_sent / (float) MB));
} else {
printf("position-%d\tsp=%d\tsocket=%d\tMbytes received=%u\n",
count++, (int) n, n->socket, (uint) (n->result->bytes_received / (float)MB));
printf("position-%d\tsp=%llu\tsocket=%d\tMbytes received=%u\n",
count++, (uint64_t) n, n->socket, (unsigned int) (n->result->bytes_received / (float) MB));
}
n = n->next;
}
@ -547,9 +547,6 @@ iperf_handle_message_client(struct iperf_test *test)
int
iperf_connect(struct iperf_test *test)
{
struct iperf_stream *sp;
int i, s = 0;
printf("Connecting to host %s, port %d\n", test->server_hostname, test->server_port);
FD_ZERO(&test->read_set);
@ -656,7 +653,7 @@ iperf_stats_callback(struct iperf_test * test)
void
iperf_reporter_callback(struct iperf_test * test)
{
int total_packets = 0, lost_packets = 0, iperf_state;
int total_packets = 0, lost_packets = 0;
char ubuf[UNIT_LEN];
char nbuf[UNIT_LEN];
struct iperf_stream *sp = NULL;
@ -845,9 +842,9 @@ iperf_new_stream(struct iperf_test *testp)
sp->socket = -1;
// XXX: Not entirely sure what this does
sp->stream_id = (int) sp;
sp->stream_id = (uint64_t) sp;
/* XXX: None of this commented code is needed since everything is set to zero anyways.
// XXX: Some of this code is needed, even though everything is already zero.
sp->packet_count = 0;
sp->jitter = 0.0;
sp->prev_transit = 0.0;
@ -863,7 +860,6 @@ iperf_new_stream(struct iperf_test *testp)
sp->result->bytes_sent = 0;
sp->result->bytes_received_this_interval = 0;
sp->result->bytes_sent_this_interval = 0;
*/
gettimeofday(&sp->result->start_time, NULL);
@ -922,7 +918,6 @@ iperf_add_stream(struct iperf_test * test, struct iperf_stream * sp)
int
iperf_client_end(struct iperf_test *test)
{
char *result_string;
struct iperf_stream *sp;
printf("Test Complete. Summary Results:\n");
@ -960,7 +955,7 @@ iperf_client_end(struct iperf_test *test)
return 0;
}
int
void
sig_handler(int sig)
{
longjmp(env, 1);
@ -970,12 +965,8 @@ int
iperf_run_client(struct iperf_test * test)
{
int result;
char *prot;
int64_t delayus, adjustus, dtargus;
fd_set temp_read_set, temp_write_set;
struct timeval tv;
struct iperf_stream *sp;
struct timer *timer, *stats_interval, *reporter_interval;
/* Start the client and connect to the server */
if (iperf_connect(test) < 0) {

Просмотреть файл

@ -135,7 +135,7 @@ int iperf_connect(struct iperf_test *);
int iperf_client_end(struct iperf_test *);
int iperf_send(struct iperf_test *);
int iperf_recv(struct iperf_test *);
int sig_handler(int);
void sig_handler(int);
#endif

Просмотреть файл

@ -193,23 +193,19 @@ iperf_handle_message_server(struct iperf_test *test)
exit(1);
default:
// XXX: This needs to be replaced by actual error handling
fprintf("How did you get here? test->state = %d\n", test->state);
fprintf(stderr, "How did you get here? test->state = %d\n", test->state);
return -1;
}
return 0;
}
void
int
iperf_run_server(struct iperf_test *test)
{
struct timeval tv;
struct iperf_stream *sp;
struct timer *stats_interval, *reporter_interval;
char *result_string = NULL;
int j = 0, result = 0, message = 0;
int nfd = 0;
int result;
int streams_accepted = 0;
struct timeval tv;
// Open socket and listen
if (iperf_server_listen(test) < 0) {
@ -297,6 +293,6 @@ iperf_run_server(struct iperf_test *test)
//memset(test->streams->settings->cookie, '\0', COOKIE_SIZE);
/* All memory for the previous run needs to be freed here */
memset(test->default_settings->cookie, '\0', COOKIE_SIZE);
return;
return 0;
}

Просмотреть файл

@ -5,7 +5,7 @@
void send_result_to_client(struct iperf_stream *);
void iperf_run_server(struct iperf_test *);
int iperf_run_server(struct iperf_test *);
int iperf_server_listen(struct iperf_test *);

Просмотреть файл

@ -156,18 +156,18 @@ iperf_udp_send(struct iperf_stream * sp)
{
case STREAM_BEGIN:
udp->state = STREAM_BEGIN;
udp->stream_id = (int) sp;
udp->stream_id = (uint64_t) sp;
/* udp->packet_count = ++sp->packet_count; */
break;
case STREAM_END:
udp->state = STREAM_END;
udp->stream_id = (int) sp;
udp->stream_id = (uint64_t) sp;
break;
case RESULT_REQUEST:
udp->state = RESULT_REQUEST;
udp->stream_id = (int) sp;
udp->stream_id = (uint64_t) sp;
break;
case ALL_STREAMS_END:
@ -176,7 +176,7 @@ iperf_udp_send(struct iperf_stream * sp)
case STREAM_RUNNING:
udp->state = STREAM_RUNNING;
udp->stream_id = (int) sp;
udp->stream_id = (uint64_t) sp;
udp->packet_count = ++sp->packet_count;
break;
}

Просмотреть файл

@ -63,4 +63,4 @@ extern char warn_invalid_single_threaded[] ;
extern char warn_invalid_report_style[] ;
extern char warn_invalid_report[] ;
#endif /* IPERF_LOCALE_H */
#endif