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

Test and fix uninitialized data in XmlRpcClient #1244

Merged

Conversation

trainman419
Copy link
Contributor

Fix test problems that were exposed by uninitialized memory, properly initialize memory and add tests for proper memory initialization.

Since uninitialized memory was causing the retry logic to be skipped in these tests, the tests have been updated to properly test the retry logic in the client.

// Check that state machine is in the correct state after getting the header.
EXPECT_EQ(XmlRpcClient::NO_CONNECTION, a._connectionState);
EXPECT_EQ(XmlRpcClient::WRITE_REQUEST, a._connectionState);
Copy link
Member

Choose a reason for hiding this comment

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

What's the rationale here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The original logic was falling into the not connected state during this test because _sendAttempts was not correctly initialized to zero. This caused the client to immediately fail instead of attempting to retry.

By fixing the initialization, the client now correctly transitions to the write request state if the header read fails on the first attempt. I've updated this test and the others to correctly capture the retry behavior and the failure if readHeader fails again on a second attempt.

@dirk-thomas
Copy link
Member

Thank you for the patch.

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.

None yet

3 participants