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

Projects
None yet
4 participants
@kpamidon
Copy link
Contributor

kpamidon commented Mar 18, 2015

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

@headius

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor Author

kpamidon commented Mar 20, 2015

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

This comment has been minimized.

Copy link
Contributor Author

kpamidon commented Mar 20, 2015

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

This comment has been minimized.

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.

Add reverse_lookup param to Socket.getaddrinfo.
Adding reverse_lookup parameter support to Socket.getaddrinfo.
This parameter was added in Ruby 1.9.

@kpamidon kpamidon force-pushed the kpamidon:socket_getaddrinfo_reverse_lookup branch from 999a7ac to d0cec55 Mar 20, 2015

@kpamidon

This comment has been minimized.

Copy link
Contributor Author

kpamidon commented Mar 20, 2015

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

1 check failed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details

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
You can’t perform that action at this time.