Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Server error when connection closed while waiting for IPERF_DONE #1765

Closed
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
14 changes: 11 additions & 3 deletions src/iperf_server_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,24 @@ iperf_handle_message_server(struct iperf_test *test)
{
int rval;
struct iperf_stream *sp;
signed char old_state = test->state;

if (test->debug_level >= DEBUG_LEVEL_INFO) {
iperf_printf(test, "Reading new State from the Client - current state is %d-%s\n", test->state, state_to_text(test->state));
iperf_printf(test, "Reading new State from the Client - current state is %d-%s\n", old_state, state_to_text(old_state));
}

// XXX: Need to rethink how this behaves to fit API
if ((rval = Nread(test->ctrl_sck, (char*) &test->state, sizeof(signed char), Ptcp)) <= 0) {
if (rval == 0) {
iperf_err(test, "the client has unexpectedly closed the connection");
i_errno = IECTRLCLOSE;
/* If control socket was closed when IPERF_DONE is expected, assume that because of race condition
* the client closed the connection before the server received the IPERF_DONE.
*/
if (old_state != DISPLAY_RESULTS) {
iperf_err(test, "the client has unexpectedly closed the connection");
i_errno = IECTRLCLOSE;
} else {
warning("client connection was closed when waiting for IPERF_DONE");
}
iperf_set_test_state(test, IPERF_DONE);
return 0;
} else {
Expand Down
Loading