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: ca3b0c10663d
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ceb2db197794
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Aug 6, 2015

  1. Copy the full SHA
    657dafd View commit details
  2. Copy the full SHA
    4d7548c View commit details
  3. 2
    Copy the full SHA
    ceb2db1 View commit details
Showing with 33 additions and 0 deletions.
  1. +2 −0 core/src/main/java/org/jruby/ext/socket/RubyTCPServer.java
  2. +26 −0 spec/ruby/core/array/uniq_spec.rb
  3. +5 −0 spec/ruby/library/socket/tcpserver/new_spec.rb
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/ext/socket/RubyTCPServer.java
Original file line number Diff line number Diff line change
@@ -101,6 +101,8 @@ public IRubyObject initialize(ThreadContext context, IRubyObject[] args) {
InetAddress addr = InetAddress.getByName(host);

ServerSocketChannel ssc = ServerSocketChannel.open();
ssc.socket().setReuseAddress(true);

InetSocketAddress socket_address = new InetSocketAddress(addr, port);

ssc.socket().bind(socket_address);
26 changes: 26 additions & 0 deletions spec/ruby/core/array/uniq_spec.rb
Original file line number Diff line number Diff line change
@@ -107,6 +107,32 @@ def obj.eql?(o)

[x, x].uniq.should == [x]
end

describe "given an array of BasicObject subclasses that define ==, eql?, and hash" do
# jruby/jruby#3227
it "filters equivalent elements using those definitions" do

basic = Class.new(BasicObject) do
attr_reader :x

def initialize(x)
@x = x
end

def ==(rhs)
@x == rhs.x
end
alias_method :eql?, :==

def hash
@x.hash
end
end

a = [basic.new(3), basic.new(2), basic.new(1), basic.new(4), basic.new(1), basic.new(2), basic.new(3)]
a.uniq.should == [basic.new(3), basic.new(2), basic.new(1), basic.new(4)]
end
end
end

describe "Array#uniq!" do
5 changes: 5 additions & 0 deletions spec/ruby/library/socket/tcpserver/new_spec.rb
Original file line number Diff line number Diff line change
@@ -84,4 +84,9 @@ def t.to_str; SocketSpecs.port.to_s; end
@server = TCPServer.new('127.0.0.1', SocketSpecs.port)
}.should raise_error(Errno::EADDRINUSE)
end

it "sets SO_REUSEADDR on the resulting server" do
@server = TCPServer.new('127.0.0.1', SocketSpecs.port)
@server.getsockopt(:SOCKET, :REUSEADDR).should == 1
end
end