Skip to content

Conversation

@davidBar-On
Copy link
Contributor

  • Version of iperf3 (or development branch, such as master or
    3.1-STABLE) to which this pull request applies:
    master

  • Issues fixed (if any): none

  • Brief description of code changes (suitable for use as a commit message):

In both error_handling and cleanup_server() in iperf_server.c, added sending SERVER_ERROR state to the client with the error info (and removed now redundant SERVER_ERROR after parameters exchange).

Also added "SERVER ERROR: ..." error message in the client, when SERVER_ERROR state is received, so it will be clear that the error printed is from the server and not the client itself. (The current error message is printed by who ever calls iperf_run_client(), e.g. main.c, so could not just change that message.)

@bmah888
Copy link
Contributor

bmah888 commented Nov 10, 2025

Thanks for the PR! I think this looks like a good change, and in addition I appreciate factoring out the copy-paste code that sends the SERVER_ERROR over the control connection. I haven't yet tried testing compatibility with existing/old versions of iperf3, have you, or do you expect they should interoperate correctly?

@davidBar-On
Copy link
Contributor Author

I haven't yet tried testing compatibility with existing/old versions of iperf3, have you, or do you expect they should interoperate correctly?

I did test with existing iperf3, but I don't expect an problem. Currently, when the server does not send SERVER_ERROR, the client can just identify that there is a connection problem. Therefore the worst case may be, if for some reason the client does not handle properly the state change, that its general error message will be changed.

@davidBar-On
Copy link
Contributor Author

... have you, or do you expect they should interoperate correctly?

I have tested now with iperf3 that does not included the change and found that behavior is indeed o.k. However, I found that if a server error occurs in iperf_accept() the client does not get the new added error messages from the server, because the server immediately closes the control socket after sending the errors (in later execution phases the control socket is not closed immediately, because the data sockets are closed first). Therefore, I added shutdown(..., SHUT_WR) before closing the control socket. I added that also to the client.

From what I checked, almost all systems should support shutdown(..., SHUT_WR), but to make sure I added a check in confugure.ac for SHUT_WR. The alternative "wait for sync" method is sleep(1) which I belie is o.k. as practically it may not be in use. If this seems as an overkill for properly supporting server error reporting to the client during iperf_accept(), I can remove the SHUT_WR related changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants