summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-09 11:11:24 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-09 11:11:24 +0000
commit268d1a2244b0179848a10a2841b4c037db52d3bd (patch)
treee07df7172bab944345a549c23a463a98ef885755 /ext
parent98ddbafb265324e9f89b2546dc85d2b54dac4c43 (diff)
* ext/socket/lib/socket.rb (family_addrinfo): return the given
addrinfo object. Patch by Ippei Obayashi. [ruby-dev:45095] [Bug #5845] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/socket/lib/socket.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb
index e7ae0a4..3abbee8 100644
--- a/ext/socket/lib/socket.rb
+++ b/ext/socket/lib/socket.rb
@@ -16,6 +16,9 @@ class Addrinfo
raise ArgumentError, "no address specified"
elsif Addrinfo === args.first
raise ArgumentError, "too many arguments" if args.length != 1
+ addrinfo = args.first
+ raise ArgumentError, "Addrinfo type mismatch" if (self.pfamily != addrinfo.pfamily) || (self.socktype != addrinfo.socktype) || (self.protocol != addrinfo.protocol)
+ addrinfo
elsif self.ip?
raise ArgumentError, "IP address needs host and port but #{args.length} arguments given" if args.length != 2
host, port = args