diff --git a/src/iperf_api.h b/src/iperf_api.h index a1ad7c2..692db0e 100755 --- a/src/iperf_api.h +++ b/src/iperf_api.h @@ -265,7 +265,6 @@ int iperf_run_server(struct iperf_test *); int iperf_server_listen(struct iperf_test *); int iperf_accept(struct iperf_test *); int iperf_handle_message_server(struct iperf_test *); -void iperf_test_reset(struct iperf_test *); int iperf_create_pidfile(struct iperf_test *); int iperf_delete_pidfile(struct iperf_test *); diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c index 931ae81..d19d350 100644 --- a/src/iperf_server_api.c +++ b/src/iperf_server_api.c @@ -222,71 +222,6 @@ iperf_handle_message_server(struct iperf_test *test) return 0; } -/* XXX: This function is not used anymore */ -void -iperf_test_reset(struct iperf_test *test) -{ - struct iperf_stream *sp; - - close(test->ctrl_sck); - - /* Free streams */ - while (!SLIST_EMPTY(&test->streams)) { - sp = SLIST_FIRST(&test->streams); - SLIST_REMOVE_HEAD(&test->streams, streams); - iperf_free_stream(sp); - } - if (test->timer != NULL) { - tmr_cancel(test->timer); - test->timer = NULL; - } - if (test->stats_timer != NULL) { - tmr_cancel(test->stats_timer); - test->stats_timer = NULL; - } - if (test->reporter_timer != NULL) { - tmr_cancel(test->reporter_timer); - test->reporter_timer = NULL; - } - test->done = 0; - - SLIST_INIT(&test->streams); - - test->role = 's'; - set_protocol(test, Ptcp); - test->omit = OMIT; - test->duration = DURATION; - test->diskfile_name = (char*) 0; - test->affinity = -1; - test->server_affinity = -1; - test->title = NULL; - test->congestion = NULL; - test->state = 0; - test->server_hostname = NULL; - - test->ctrl_sck = -1; - test->prot_listener = -1; - - test->bytes_sent = 0; - - test->reverse = 0; - test->sender = 0; - test->sender_has_retransmits = 0; - test->no_delay = 0; - - FD_ZERO(&test->read_set); - FD_ZERO(&test->write_set); - FD_SET(test->listener, &test->read_set); - test->max_fd = test->listener; - - test->num_streams = 1; - test->settings->socket_bufsize = 0; - test->settings->blksize = DEFAULT_TCP_BLKSIZE; - test->settings->rate = 0; - test->settings->mss = 0; - memset(test->cookie, 0, COOKIE_SIZE); -} - static void server_timer_proc(TimerClientData client_data, struct timeval *nowP) { diff --git a/src/libiperf.3 b/src/libiperf.3 index 5813a14..783e5a2 100644 --- a/src/libiperf.3 +++ b/src/libiperf.3 @@ -38,7 +38,7 @@ Running a test: .nf int iperf_run_client(struct iperf_test *); int iperf_run_server(struct iperf_test *); - void iperf_test_reset(struct iperf_test *); + void iperf_reset_test(struct iperf_test *); .fi Output: .nf diff --git a/src/net.c b/src/net.c index afd0022..290da77 100644 --- a/src/net.c +++ b/src/net.c @@ -398,84 +398,6 @@ Nsendfile(int fromfd, int tofd, const char *buf, size_t count) /*************************************************************************/ -/** - * getsock_tcp_mss - Returns the MSS size for TCP - * - */ - -int -getsock_tcp_mss(int inSock) -{ - int mss = 0; - - int rc; - socklen_t len; - - assert(inSock >= 0); /* print error and exit if this is not true */ - - /* query for mss */ - len = sizeof(mss); - rc = getsockopt(inSock, IPPROTO_TCP, TCP_MAXSEG, (char *)&mss, &len); - if (rc == -1) { - perror("getsockopt TCP_MAXSEG"); - return -1; - } - - return mss; -} - - - -/*************************************************************/ - -/* sets TCP_NODELAY and TCP_MAXSEG if requested */ -// XXX: This function is not being used. - -int -set_tcp_options(int sock, int no_delay, int mss) -{ - socklen_t len; - int rc; - int new_mss; - - if (no_delay == 1) { - len = sizeof(no_delay); - rc = setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&no_delay, len); - if (rc == -1) { - perror("setsockopt TCP_NODELAY"); - return -1; - } - } -#ifdef TCP_MAXSEG - if (mss > 0) { - len = sizeof(new_mss); - assert(sock != -1); - - /* set */ - new_mss = mss; - len = sizeof(new_mss); - rc = setsockopt(sock, IPPROTO_TCP, TCP_MAXSEG, (char *)&new_mss, len); - if (rc == -1) { - perror("setsockopt TCP_MAXSEG"); - return -1; - } - /* verify results */ - rc = getsockopt(sock, IPPROTO_TCP, TCP_MAXSEG, (char *)&new_mss, &len); - if (rc == -1) { - perror("getsockopt TCP_MAXSEG"); - return -1; - } - if (new_mss != mss) { - perror("setsockopt value mismatch"); - return -1; - } - } -#endif - return 0; -} - -/****************************************************************************/ - int setnonblocking(int fd, int nonblocking) { diff --git a/src/net.h b/src/net.h index 9cfc522..3738d6a 100644 --- a/src/net.h +++ b/src/net.h @@ -34,8 +34,6 @@ int Nread(int fd, char *buf, size_t count, int prot); int Nwrite(int fd, const char *buf, size_t count, int prot) /* __attribute__((hot)) */; int has_sendfile(void); int Nsendfile(int fromfd, int tofd, const char *buf, size_t count) /* __attribute__((hot)) */; -int getsock_tcp_mss(int inSock); -int set_tcp_options(int sock, int no_delay, int mss); int setnonblocking(int fd, int nonblocking); int getsockdomain(int sock); int parse_qos(const char *tos);