Add Time Flag For The Iperf Server Process #1684
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PLEASE NOTE the following text from the iperf3 license. Submitting a
pull request to the iperf3 repository constitutes "[making]
Enhancements available...publicly":
The complete iperf3 license is available in the
LICENSE
file in thetop directory of the iperf3 source tree.
Version of iperf3 (or development branch, such as
master
or3.1-STABLE
) to which this pull request applies: masterIssues fixed (if any): Enable '-t X' option in server mode #354, Server-side limiting switches #615
Brief description of code changes (suitable for use as a commit message):
These changes add the functionality as requested by the linked issues. Specifically, this functionality allows the server to determine the maximum duration of an
iperf
measurement. The implementation is similar to the--server-bitrate-limit
flag, where the measurement is forcibly stopped when an interval has exceeded the server's configured bitrate. In this case, the measurement is forcibly stopped when the duration exceeds the server's configured time, which is the value of--server-time
.Example
From the dropdowns below, we can see that the server has enforced a measurement time of
3
seconds. The client attempts to run the measurement for4
seconds. When the 3rd second is exceeded, the socket is forcibly closed.server
client
client_json
Implementation Details
With this implementation, the server overrides the value of
test->duration
with the value that was passed in via the--server-time
flag. We can see from the drop downs that the client's experience is similar to when the bitrate limit is exceeded with the error:iperf3: error - control socket has closed unexpectedly
. However, the server side is less friendly, with an error ofiperf3: error - select failed: Bad file descriptor
. I can already envision myself encountering this error and not knowing why I am getting it, as well as forgetting that I had set the--server-time
flag to begin with.Another thing to note is that nothing is stopping the user from setting a high value for
--omit
. Given that this feature is meant to protect the server, is it reasonable to include a--server-omit
option to enforce a maximum value?Update (04/18/2024)
Since the first commit, I've introduced a solution for the error
iperf3: error - select failed: Bad file descriptor
which provides a more friendly experience. Let's consider the scenario where the--server-time
flag has been set on the server to a value of3
:3
for the server time3
. If the client's duration is greater than the server's, then the server's value is selected for the timer.The JSON output also has a new field which specifies the server's value for duration:
server_duration
client_json
Update (06/05/2024)
A valid question was brought up by @TheRealDJ:
What happens when the server has this feature but the client doesn't?
. With the current implementation, there is no backwards compatability. Further discussions will need to be had in order to handle this case properly.