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

Made example more comprehensive #9

Merged
merged 5 commits into from
Jun 3, 2024
Merged

Conversation

jackctj117
Copy link
Contributor

Just added some better print outs for connections between server and client.

@@ -61,8 +60,7 @@ static void* wh_ClientTask(void* cf)
ret = wh_Client_EchoRequest(client,
tx_req_len, tx_req);
if( ret != WH_ERROR_NOTREADY) {
printf("Client EchoRequest:%d, len:%d, %s\n",
ret, tx_req_len, tx_req);
continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should just remove this if statement if it no longer does anything, no point in keeping it around. Though it would be helpful to keep a printout that displays the error code that caused the failure. Why did you want to remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it to just clean up the output, I can re add it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or would you rather I get rid of the statement?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that output would only be shown if there was a real error, so I'd keep it in. Maybe just make the printout more clear, since I think tx_req and tx_req_len wouldn't be populated on error anyway. Something like printf("wh_Client_EchoRequest failed with ret=%d\n", ret);

@bigbrett bigbrett removed their assignment May 30, 2024
@dgarske dgarske assigned jackctj117 and unassigned wolfSSL-Bot and jackctj117 May 30, 2024
Comment on lines 64 to 68
if(ret != WH_ERROR_NOTREADY) {
if (!connectionMessage) {
printf("Successful connection!\n");
connectionMessage = 1;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is wrong, it prints Successful connection when the client fails to connect

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought != WH_ERROR_NOTREADY meant it was a pass, before I changed the contents of that case what ever is in it prints out. If that case is a fail then it seems the example has more issues than originally thought.

Copy link
Contributor

@bigbrett bigbrett Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the example is correct as it was written (at least this part of it), your assumption about how it works is incorrect. ret != WH_ERROR_NOTREADY doesn't mean it is a pass, the function could very well return a fatal error here. But if it returns 0 then it is success. Note the conditions of the do while loop. The original example printed the return value and the contents of the buffer on success AND if there was an error code != WH_ERROR_NOTREADY just for debugging purposes. You just changed that to say "success", when in reality a fatal error code could have been returned.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, I will fix this. Thank you for the clarification!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe I addressed the case appropriately now.

@jackctj117 jackctj117 requested a review from bigbrett May 31, 2024 21:34
Jack Tjaden and others added 2 commits June 3, 2024 09:22
@bigbrett bigbrett merged commit e9254e2 into wolfSSL:main Jun 3, 2024
1 check passed
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.

3 participants