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

Commits on Oct 19, 2015

  1. Copy the full SHA
    579675e View commit details
  2. Copy the full SHA
    592b5ee View commit details
4 changes: 2 additions & 2 deletions lib/ruby/truffle/rubysl/rubysl-socket/lib/rubysl/socket.rb
Original file line number Diff line number Diff line change
@@ -564,7 +564,7 @@ def listen(backlog)
end

def accept
return if closed?
raise IOError, "closed stream" if closed? # Truffle: comply with MRI

fd = super

@@ -578,7 +578,7 @@ def accept
# Set nonblocking and accept.
#
def accept_nonblock
return if closed?
raise IOError, "closed stream" if closed? # Truffle: comply with MRI

fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK)

9 changes: 7 additions & 2 deletions spec/ruby/library/socket/tcpserver/accept_nonblock_spec.rb
Original file line number Diff line number Diff line change
@@ -3,11 +3,11 @@

describe "Socket::TCPServer.accept_nonblock" do
before :each do
@server = TCPServer.new("127.0.0.1", SocketSpecs.port)
@server = TCPServer.new("127.0.0.1", SocketSpecs.port)
end

after :each do
@server.close
@server.close unless @server.closed?
end

it "accepts non blocking connections" do
@@ -28,4 +28,9 @@
c.close
s.close
end

it "raises an IOError if the socket is closed" do
@server.close
lambda { @server.accept }.should raise_error(IOError)
end
end
5 changes: 5 additions & 0 deletions spec/ruby/library/socket/tcpserver/accept_spec.rb
Original file line number Diff line number Diff line change
@@ -58,4 +58,9 @@
t.raise ex
lambda { t.join }.should raise_error(Exception)
end

it "raises an IOError if the socket is closed" do
@server.close
lambda { @server.accept }.should raise_error(IOError)
end
end