Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/iperf_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ enum {
IESETCNTLKAINTERVAL = 157, // Unable to set/get socket keepalive TCP retry interval (TCP_KEEPINTVL) option
IESETCNTLKACOUNT = 158, // Unable to set/get socket keepalive TCP number of retries (TCP_KEEPCNT) option
IEPTHREADSIGMASK=159, // Unable to initialize sub thread signal mask (check perror)
IESERVERTESTDURATIONEXPIRED = 160, // Server test duration expired
/* Stream errors */
IECREATESTREAM = 200, // Unable to create a new stream (check herror/perror)
IEINITSTREAM = 201, // Unable to initialize stream (check herror/perror)
Expand Down
4 changes: 4 additions & 0 deletions src/iperf_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,10 @@ iperf_strerror(int int_errno)
case IEMAXSERVERTESTDURATIONEXCEEDED:
snprintf(errstr, len, "client's requested duration exceeds the server's maximum permitted limit");
break;
case IESERVERTESTDURATIONEXPIRED:
snprintf(errstr, len, "server test duration expired");
perr = 1;
break;
default:
snprintf(errstr, len, "int_errno=%d", int_errno);
perr = 1;
Expand Down
21 changes: 21 additions & 0 deletions src/iperf_server_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,32 @@ static void
server_timer_proc(TimerClientData client_data, struct iperf_time *nowP)
{
struct iperf_test *test = client_data.p;
struct iperf_stream *sp;
int32_t err;

test->timer = NULL;
if (test->done)
return;
test->done = 1;
iperf_err(test, "error - server test duration expired - test is terminated by the server");
if (iperf_set_send_state(test, SERVER_ERROR) == 0) {
i_errno = IESERVERTESTDURATIONEXPIRED;
err = htonl(i_errno);
if (Nwrite(test->ctrl_sck, (char*) &err, sizeof(err), Ptcp) == sizeof(err)) {
err = 0;
Nwrite(test->ctrl_sck, (char*) &err, sizeof(err), Ptcp);
};
}
/* Free streams */
while (!SLIST_EMPTY(&test->streams)) {
sp = SLIST_FIRST(&test->streams);
if (sp->socket != -1) {
SLIST_REMOVE_HEAD(&test->streams, streams);
close(sp->socket);
sp->socket = -1;
iperf_free_stream(sp);
}
}
close(test->ctrl_sck);
test->ctrl_sck = -1;
}
Expand Down