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

Manage ipv6 in get_ip_str function #116

Merged
merged 2 commits into from
Nov 11, 2017
Merged

Manage ipv6 in get_ip_str function #116

merged 2 commits into from
Nov 11, 2017

Conversation

GMercat
Copy link
Contributor

@GMercat GMercat commented Nov 7, 2017

sockaddr_in (IPv4) is the same size as sockaddr, which is why getnameinfo() is working for IPv4. But sockaddr_in6 (IPv6) is larger than sockaddr, which is why getnameinfo() fails.

sockaddr_in (IPv4) is the same size as sockaddr, which is why getnameinfo() is working for IPv4. But sockaddr_in6 (IPv6) is larger than sockaddr, which is why getnameinfo() fails.
{
result = to_ret;
}
else
Copy link
Owner

Choose a reason for hiding this comment

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

The rest looks good but I am not sure why you are clearing the result 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.

I can remove the else statement, no prob.

Because it's how i code 😉 For this type of function, i prefer return a cleared object instead of do nothing about it. Users of this function have always a coherent object (setted or cleared). It's just my point of view.

Tell me what do you want, remove or not?

Copy link
Owner

Choose a reason for hiding this comment

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

And you are probably right. For now, remove it though for consistency with the rest of the codebase.

I am anyhow disagreeing with my old self here and I am going to rewrite the signature of those methods to avoid passing in input references (let the return values be return values) so the clear shouldn't be necessary anymore (sorry... I saw this part of my old code while reviewing your CR and I shivered).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok.

It's never easy to re-read our old code 😄

@etr etr merged commit 8c05ebc into etr:master Nov 11, 2017
@etr
Copy link
Owner

etr commented Nov 11, 2017

Merging. Thanks for the work!

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.

2 participants