Bug #8039 » drb.socket_shutdown_fix.patch
| lib/drb/drb.rb (working copy) | ||
|---|---|---|
|
def set_sockopt(soc) # :nodoc:
|
||
|
soc.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
|
||
|
soc.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) if defined? Fcntl::FD_CLOEXEC
|
||
|
rescue Errno::EINVAL
|
||
|
# socket was closed
|
||
|
end
|
||
|
end
|
||
| test/drb/test_drbtcp.rb (working copy) | ||
|---|---|---|
|
require 'drb'
|
||
|
class TestDRbTCP < Test::Unit::TestCase
|
||
|
def test_set_sockopt
|
||
|
server = DRb::DRbServer.new('druby://:0')
|
||
|
host, port, = DRb::DRbTCPSocket.send(:parse_uri, server.uri)
|
||
|
socket = TCPSocket.open host, port
|
||
|
socket.shutdown
|
||
|
client = DRb::DRbTCPSocket.new(server.uri, socket)
|
||
|
assert client
|
||
|
client.close
|
||
|
server.stop_service
|
||
|
end
|
||
|
end
|
||