Remove unused functions (#668)
Namely, getsock_tcp_mss(), set_tcp_options() and iperf_test_reset(). Also fix a typo in the libiperf manual; iperf_test_reset() was listed instead of iperf_reset_test().
Этот коммит содержится в:
родитель
e6d6661276
Коммит
34f878a2c0
@ -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 *);
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
78
src/net.c
78
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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user