Skip to content

BasicSocket.shutdown() is not compliant for >= 1.9.x #1579

@coffeeaddict

Description

@coffeeaddict

Hi,

with the following script:

require 'socket'
require 'json'

puts "v#{RUBY_VERSION}"

start = Time.now
s = TCPSocket.new 'localhost', 1234
s.write({ address: "some-bus-address", payload: { foo: "bar-#{i}" } }.to_json)
s.shutdown(:RDWR)
puts "#{i} Done in %.5fs" % (Time.now - start).to_f

I get the following error:

v1.9.3
TypeError: can't convert Symbol into Integer
  shutdown at org/jruby/ext/socket/RubyBasicSocket.java:379
    (root) at client.rb:14

According to http://www.ruby-doc.org/stdlib-1.9.3/libdoc/socket/rdoc/BasicSocket.html#method-i-shutdown the argument for shutdown can be a number, symbol or a string. This changed since 1.8.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions