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

Socket.getaddrinfo reverse_lookup #2724

Merged

Conversation

kpamidon
Copy link
Contributor

Added the reverse_lookup parameter to Socket.getaddrinfo. This was added in Ruby 1.9.

@headius
Copy link
Member

headius commented Mar 19, 2015

This looks good. Maybe we can modify it to use boolean instead of Boolean and just have a separate method with no boolean parameter for the "null" behavior you have now?

@kpamidon
Copy link
Contributor Author

I'm not quite sure how to completely get rid of the Boolean, since the current code relies on the buildAddrinfoList() function to process the args array before sending the processed args on to the AddrinfoCabllack() function.

If the concern is over having the getHostAddress(ThreadContext context, InetAddress addr) function call the getHostAddress(ThreadContext context, InetAddress addr, boolean reverse) function and pass in a null for the last parameter, I can do what you suggest and leave the original getHostAddress(ThreadContext context, InetAddress addr) function alone; however, I can't see a way to get around then having to do something ugly like the following inside the AddrInfoCallback() to select the appropriate function call:

                    if (reverse == null) {
                        c[2] = runtime.newString(getHostAddress(context, address));
                    } else {
                        c[2] = runtime.newString(getHostAddress(context, address, reverse));
                    }

@kpamidon
Copy link
Contributor Author

I noticed I've made a serious error in doing a String comparison using the == operator in my initial Pull Request. I'm new to the Git paradigm; is the proper procedure here to make a brand new Pull Request, with the fixed code and close this one?

@atambo
Copy link
Member

atambo commented Mar 20, 2015

Just amend your fix to your existing commit and do a force push to your socket_getaddrinfo_reverse_lookup branch and it will update on this pull request.

Adding reverse_lookup parameter support to Socket.getaddrinfo.
This parameter was added in Ruby 1.9.
@kpamidon kpamidon force-pushed the socket_getaddrinfo_reverse_lookup branch from 999a7ac to d0cec55 Compare March 20, 2015 14:49
@kpamidon
Copy link
Contributor Author

Amending and force pushing worked like a charm, thanks.

headius added a commit that referenced this pull request May 8, 2015
@headius headius merged commit 837cb73 into jruby:jruby-1_7 May 8, 2015
headius added a commit that referenced this pull request May 8, 2015
@enebo enebo added this to the JRuby 9.0.0.0.rc1 milestone Jun 10, 2015
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

4 participants