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: 5a63f8c6c53d
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 25585531498c
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Feb 24, 2017

  1. Copy the full SHA
    d957e17 View commit details
  2. Merge pull request #4503 from snowp/snowp/close_write

    Allow reads after calling BasicSocket#close_write.
    headius authored Feb 24, 2017
    Copy the full SHA
    2558553 View commit details
Showing with 7 additions and 1 deletion.
  1. +2 −1 core/src/main/java/org/jruby/ext/socket/RubyBasicSocket.java
  2. +5 −0 spec/ruby/library/socket/basicsocket/close_write_spec.rb
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/ext/socket/RubyBasicSocket.java
Original file line number Diff line number Diff line change
@@ -456,7 +456,8 @@ private IRubyObject closeHalf(ThreadContext context, int closeHalf) {
}

// shutdown half
shutdownInternal(context, fptr, 0);
int how = closeHalf == OpenFile.READABLE ? 0 : 1;
shutdownInternal(context, fptr, how);
fptr.setMode(fptr.getMode() & ~closeHalf);

return context.nil;
5 changes: 5 additions & 0 deletions spec/ruby/library/socket/basicsocket/close_write_spec.rb
Original file line number Diff line number Diff line change
@@ -26,6 +26,11 @@
@server.closed?.should be_false
end

it "does not prevent reading" do
@server.close_write
@server.read(0).should == ""
end

it "fully closes the socket if it was already closed for reading" do
@server.close_read
@server.close_write