Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 98c71afbad69
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2b67b11da8ea
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Dec 24, 2015

  1. Copy the full SHA
    5beeabe View commit details

Commits on Dec 26, 2015

  1. Merge pull request #3494 from mrbrdo/unixsocket_for_fd

    Proper support for UNIXSocket.for_fd
    headius committed Dec 26, 2015
    Copy the full SHA
    2b67b11 View commit details
Showing with 12 additions and 0 deletions.
  1. +12 −0 core/src/main/java/org/jruby/ext/socket/RubyUNIXSocket.java
12 changes: 12 additions & 0 deletions core/src/main/java/org/jruby/ext/socket/RubyUNIXSocket.java
Original file line number Diff line number Diff line change
@@ -74,6 +74,18 @@ public RubyUNIXSocket(Ruby runtime, RubyClass type) {
super(runtime, type);
}

@JRubyMethod(meta = true)
public static IRubyObject for_fd(ThreadContext context, IRubyObject recv, IRubyObject _fileno) {
Ruby runtime = context.runtime;
int fileno = (int)_fileno.convertToInteger().getLongValue();

RubyClass klass = (RubyClass)recv;
RubyUNIXSocket unixSocket = (RubyUNIXSocket)(Helpers.invoke(context, klass, "allocate"));
UnixSocketChannel channel = UnixSocketChannel.fromFD(fileno);
unixSocket.init_sock(runtime, channel);
return unixSocket;
}

@JRubyMethod(visibility = Visibility.PRIVATE)
public IRubyObject initialize(ThreadContext context, IRubyObject path) {
init_unixsock(context.runtime, path, false);