Fix a problem that could disrupt existing tests.

By design, an iperf3 server only runs one test at a time.  New
connections from other clients (during an existing test) are
rejected.  A problem is that the server code that rejects the test
tries (for some reason) to read the cookie from the client, even
though it's going to reject the connection anyway.

A way to break an existing test is:  With a test running, make a TCP
connection to the server's control port (this can easily be done with
a telnet client).  The server will hang in a blocking read call trying
to read the cookie from a non-existent client, while the test is
essentially frozen.

The fix is to remove the attempted read of the cookie.

Fixes #202.
This commit is contained in:
Bruce A. Mah 2014-08-27 14:48:09 -07:00
parent aea943c31a
commit 40d45dcf34

View File

@ -143,11 +143,10 @@ iperf_accept(struct iperf_test *test)
if (test->on_connect)
test->on_connect(test);
} else {
/* XXX: Do we even need to receive cookie if we're just going to deny anyways? */
if (Nread(s, cookie, COOKIE_SIZE, Ptcp) < 0) {
i_errno = IERECVCOOKIE;
return -1;
}
/*
* Don't try to read from the socket. It could block an ongoing test.
* Just send ACCESS_DENIED.
*/
if (Nwrite(s, (char*) &rbuf, sizeof(rbuf), Ptcp) < 0) {
i_errno = IESENDMESSAGE;
return -1;