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

network: address socket interface pointer instead of name #12550

Merged
merged 5 commits into from
Aug 12, 2020

Conversation

florincoras
Copy link
Member

Signed-off-by: Florin Coras [email protected]

Risk Level: Low
Testing: unit tests
Docs Changes: n/a
Release Notes: n/a

antoniovicente
antoniovicente previously approved these changes Aug 7, 2020
Copy link
Contributor

@antoniovicente antoniovicente left a comment

Choose a reason for hiding this comment

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

Looks great.

@dio dio assigned lizan Aug 7, 2020
Copy link
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

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

Thanks, this looks much better. Just some style nits.

@@ -47,6 +47,10 @@ std::string friendlyNameFromAbstractPath(absl::string_view path) {

} // namespace

static inline const SocketInterface* sockInterfaceOrDefault(const SocketInterface* sock_interface) {
Copy link
Member

Choose a reason for hiding this comment

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

style nit: put this in unnamed namespace above, remove static, doesn't have to be inline?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a C reflex of mine that I use instead of macros. Goal would be to convince the compiler to avoid extra function calls when not needed. But obviously, no strong opinion here ...

Copy link
Member

Choose a reason for hiding this comment

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

C++ inline isn't guaranteed to be inlined, all are decided by compiler, it's more of working around one-definition rule.

Copy link
Member Author

Choose a reason for hiding this comment

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

Understood!

*/
virtual const std::string& socketInterface() const PURE;
virtual const Network::SocketInterface* socketInterface() const PURE;
Copy link
Member

Choose a reason for hiding this comment

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

let's return reference, it's no longer nullable.

Copy link
Member Author

Choose a reason for hiding this comment

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

We'll have to keep the const because of how we pass the SocketInterface pointer to the Address. Is that okay or were you thinking about something more complex?

Copy link
Member

Choose a reason for hiding this comment

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

ah of couse, const wherever possible :)

}

std::string friendly_name_;
std::string socket_interface_;
const SocketInterface* socket_interface_;
Copy link
Member

Choose a reason for hiding this comment

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

This can be const ref as well

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

Copy link
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

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

Thanks!

@florincoras
Copy link
Member Author

Thanks!

Thank you for the review!

@mattklein123 mattklein123 merged commit 18a5124 into envoyproxy:master Aug 12, 2020
@florincoras florincoras deleted the addr_sock branch August 28, 2020 20:02
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.

4 participants