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

Remove Parser::statusToInt(). #21288

Merged
merged 1 commit into from
May 16, 2022
Merged

Remove Parser::statusToInt(). #21288

merged 1 commit into from
May 16, 2022

Conversation

bencebeky
Copy link
Contributor

The motivation is that the int errno is implementation-specific (in this
case defined by http-parser). Removing this method from the abstract
Parser interface and changing
ParserCallbacks::setAndCheckCallbackStatus* methods to return
ParserStatus instead of this implementation-specific int will make it
simpler to add another Parser implementation, one not based on
http-parser.

Instead of applying statusToInt() within setAndCheckCallbackStatus() and
setAndCheckCallbackStatusOr() before returning in ConnectionImpl, return
ParserStatus, and apply statusToInt() within LegacyHttpParserImpl. This
allows statusToInt() to be moved to legacy_parser_impl.cc anonymous
namespace, right next to its counterpart intToStatus().

Tracking issue: #21245

Signed-off-by: Bence Béky bnc@google.com

Commit Message:
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

The motivation is that the int errno is implementation-specific (in this
case defined by http-parser).  Removing this method from the abstract
Parser interface and changing
ParserCallbacks::setAndCheckCallbackStatus* methods to return
ParserStatus instead of this implementation-specific int will make it
simpler to add another Parser implementation, one not based on
http-parser.

Instead of applying statusToInt() within setAndCheckCallbackStatus() and
setAndCheckCallbackStatusOr() before returning in ConnectionImpl, return
ParserStatus, and apply statusToInt() within LegacyHttpParserImpl.  This
allows statusToInt() to be moved to legacy_parser_impl.cc anonymous
namespace, right next to its counterpart intToStatus().

Tracking issue: #21245

Signed-off-by: Bence Béky <bnc@google.com>
@repokitteh-read-only
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #21288 was opened by bencebeky.

see: more, trace.

@bencebeky bencebeky marked this pull request as ready for review May 13, 2022 19:36
@bencebeky
Copy link
Contributor Author

/assign @KBaichoo

Copy link
Contributor

@KBaichoo KBaichoo left a comment

Choose a reason for hiding this comment

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

lgtm, thanks

@KBaichoo KBaichoo merged commit 932ba9d into envoyproxy:main May 16, 2022
@bencebeky bencebeky deleted the callback branch May 17, 2022 16:52
ravenblackx pushed a commit to ravenblackx/envoy that referenced this pull request Jun 8, 2022
The motivation is that the int errno is implementation-specific (in this
case defined by http-parser).  Removing this method from the abstract
Parser interface and changing
ParserCallbacks::setAndCheckCallbackStatus* methods to return
ParserStatus instead of this implementation-specific int will make it
simpler to add another Parser implementation, one not based on
http-parser.

Instead of applying statusToInt() within setAndCheckCallbackStatus() and
setAndCheckCallbackStatusOr() before returning in ConnectionImpl, return
ParserStatus, and apply statusToInt() within LegacyHttpParserImpl.  This
allows statusToInt() to be moved to legacy_parser_impl.cc anonymous
namespace, right next to its counterpart intToStatus().

Tracking issue: envoyproxy#21245

Signed-off-by: Bence Béky <bnc@google.com>
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