You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2011/12/13 19:33:16 UTC
svn commit: r1213837 - in /thrift/trunk/lib/rb:
lib/thrift/transport/socket.rb spec/socket_spec.rb
Author: bryanduxbury
Date: Tue Dec 13 18:33:15 2011
New Revision: 1213837
URL: http://svn.apache.org/viewvc?rev=1213837&view=rev
Log:
THRIFT-1449. rb: Ruby client does not work on solaris (?)
This patch adds a new argument to the socket calls that seems to fix the problems while not causing any detriment to non-Solaris systems.
Patch: Erik Hetzner
Modified:
thrift/trunk/lib/rb/lib/thrift/transport/socket.rb
thrift/trunk/lib/rb/spec/socket_spec.rb
Modified: thrift/trunk/lib/rb/lib/thrift/transport/socket.rb
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/rb/lib/thrift/transport/socket.rb?rev=1213837&r1=1213836&r2=1213837&view=diff
==============================================================================
--- thrift/trunk/lib/rb/lib/thrift/transport/socket.rb (original)
+++ thrift/trunk/lib/rb/lib/thrift/transport/socket.rb Tue Dec 13 18:33:15 2011
@@ -34,7 +34,7 @@ module Thrift
def open
begin
- addrinfo = ::Socket::getaddrinfo(@host, @port).first
+ addrinfo = ::Socket::getaddrinfo(@host, @port, nil, ::Socket::SOCK_STREAM).first
@handle = ::Socket.new(addrinfo[4], ::Socket::SOCK_STREAM, 0)
sockaddr = ::Socket.sockaddr_in(addrinfo[1], addrinfo[3])
begin
@@ -134,4 +134,4 @@ module Thrift
@handle
end
end
-end
\ No newline at end of file
+end
Modified: thrift/trunk/lib/rb/spec/socket_spec.rb
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/rb/spec/socket_spec.rb?rev=1213837&r1=1213836&r2=1213837&view=diff
==============================================================================
--- thrift/trunk/lib/rb/spec/socket_spec.rb (original)
+++ thrift/trunk/lib/rb/spec/socket_spec.rb Tue Dec 13 18:33:15 2011
@@ -41,14 +41,14 @@ class ThriftSocketSpec < Spec::ExampleGr
it "should open a ::Socket with default args" do
::Socket.should_receive(:new).and_return(mock("Handle", :connect_nonblock => true))
- ::Socket.should_receive(:getaddrinfo).with("localhost", 9090).and_return([[]])
+ ::Socket.should_receive(:getaddrinfo).with("localhost", 9090, nil, ::Socket::SOCK_STREAM).and_return([[]])
::Socket.should_receive(:sockaddr_in)
@socket.open
end
it "should accept host/port options" do
::Socket.should_receive(:new).and_return(mock("Handle", :connect_nonblock => true))
- ::Socket.should_receive(:getaddrinfo).with("my.domain", 1234).and_return([[]])
+ ::Socket.should_receive(:getaddrinfo).with("my.domain", 1234, nil, ::Socket::SOCK_STREAM).and_return([[]])
::Socket.should_receive(:sockaddr_in)
Socket.new('my.domain', 1234).open
end