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

[XrdCl] Refactor kXR_status response handling. #1854

Merged
merged 1 commit into from
Feb 14, 2023

Conversation

simonmichal
Copy link
Contributor

Move kXR_status response handling to AsyncMsgReader.

@amadio
Copy link
Member

amadio commented Feb 13, 2023

Should this be rebased/merged soon? Is this for 5.5.3 or for 5.6?

@simonmichal
Copy link
Contributor Author

@amadio : actually now would be the perfect time to merge it, could you have a look and do a quick review?

//----------------------------------------------------------------
// The next step is to finalize the read
//----------------------------------------------------------------
readstage = ReadDone;
Copy link
Member

Choose a reason for hiding this comment

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

Can ReadMore be required more than once?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, certainly

Copy link
Member

Choose a reason for hiding this comment

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

What I wonder is if setting readstage = ReadDone will not prevent ReadMore from being called twice in a row if needed.

return st;
}

if( !st.IsOK() )
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need to test twice for !st.IsOK()? Could these two ifs not be joined into a single one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well, the first one is a special case where we have corrupted data, the other one handles all other errors, the only difference is the format of the error message (I wanted to preserve the original log message structure)

Copy link
Member

Choose a reason for hiding this comment

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

Sure, but you can have an if ( !st.IsOK() ), and inside it have another if (or switch) to treat differently the different kinds of errors. But I guess this is not so performance critical, so it's not the end of the world if we check twice.

// Do the integrity checks
//--------------------------------------------------------------------------
if( crcval != cse->cseCRC )
switch( reqType )
Copy link
Member

Choose a reason for hiding this comment

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

Why a switch with a single case inside? Do you intend this to be expanded with more cases later on?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, exactly! right now kXR_status is used only for 'pgread'/'pgwrite' but in the future it could be used for other requests hence the switch statement.

@simonmichal simonmichal merged commit ca73565 into master Feb 14, 2023
@amadio amadio deleted the xrdcl-statusrsp-more branch August 25, 2023 12:58
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

2 participants