http: use std::function for headermap iteration#12103
Merged
mattklein123 merged 7 commits intoenvoyproxy:masterfrom Jul 17, 2020
Merged
http: use std::function for headermap iteration#12103mattklein123 merged 7 commits intoenvoyproxy:masterfrom
mattklein123 merged 7 commits intoenvoyproxy:masterfrom
Conversation
The existing cast-to-void*-then-back method for passing in a context is type-unsafe and can make for hard-to-locate errors. By using a std::function instead of a function pointer, the caller can get compilation error instead of runtime errors, and doesn't have to do any sort of bundling dance with std::pair or a custom struct to pass multiple context items in. Signed-off-by: Alex Konradi <akonradi@google.com>
297130d to
3e63d74
Compare
Member
mattklein123
left a comment
There was a problem hiding this comment.
I don't recall why I wrote the code originally the way it was, but I think this is a fine change, and I'm guessing in most cases with SVO there won't be any heap allocation for the function. Can you kick CI somehow?
/wait
Member
|
Coverage error is maybe legit? /wait |
Contributor
Author
|
Running the coverage again locally, but my guess is that this made the tested code less verbose so now the untested portion is a larger percentage by LOC 😿. Worst case I'll add some test cases. |
This case was not covered and was causing coverage runs to fail Signed-off-by: Alex Konradi <akonradi@google.com>
Signed-off-by: Alex Konradi <akonradi@google.com>
Signed-off-by: Alex Konradi <akonradi@google.com>
Add the references that were supposed to be included in the previous commit Signed-off-by: Alex Konradi <akonradi@google.com>
mattklein123
previously approved these changes
Jul 16, 2020
Member
|
Sorry do you mind fixing the remaining tidy issues? Some of them are pre-existing but should be pretty simple. /wait |
Signed-off-by: Alex Konradi <akonradi@google.com>
mattklein123
approved these changes
Jul 17, 2020
rebello95
added a commit
to envoyproxy/envoy-mobile
that referenced
this pull request
Jul 22, 2020
- Update bazel to 3.4.1 (depends on envoyproxy/envoy#12123) - Update envoy upstream to include ^ - Update rules apple and rules swift - Update our header map iteration to fix breaking changes upstream from envoyproxy/envoy#12103 Signed-off-by: Michael Rebello <me@michaelrebello.com>
KBaichoo
pushed a commit
to KBaichoo/envoy
that referenced
this pull request
Jul 30, 2020
The existing cast-to-void*-then-back method for passing in a context is type-unsafe and can make for hard-to-locate errors. By using a std::function instead of a function pointer, the caller can get compilation error instead of runtime errors, and doesn't have to do any sort of bundling dance with std::pair or a custom struct to pass multiple context items in. Signed-off-by: Alex Konradi <akonradi@google.com> Signed-off-by: Kevin Baichoo <kbaichoo@google.com>
scheler
pushed a commit
to scheler/envoy
that referenced
this pull request
Aug 4, 2020
The existing cast-to-void*-then-back method for passing in a context is type-unsafe and can make for hard-to-locate errors. By using a std::function instead of a function pointer, the caller can get compilation error instead of runtime errors, and doesn't have to do any sort of bundling dance with std::pair or a custom struct to pass multiple context items in. Signed-off-by: Alex Konradi <akonradi@google.com> Signed-off-by: scheler <santosh.cheler@appdynamics.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The existing cast-to-void*-then-back method for passing in a context is type-unsafe and can make for hard-to-locate errors. By using a std::function instead of a function pointer, the caller can get compilation error instead of runtime errors, and doesn't have to do any sort of bundling dance with std::pair or a custom struct to pass multiple context items in.
Commit Message: Make HeaderMap::ConstIterateCb a std::function
Additional Description:
Remove the type-unsafe void* context parameter since it can be bundled, with type checking, into a std::function object instead.
Risk Level: low
Testing: ran unit and integration tests
Docs Changes: none
Release Notes: none