summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-09 11:18:00 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-09 11:18:00 +0000
commitbb1115a2d6b1ab37a1ae725bc26a965884f44029 (patch)
treee322e816b5405d1688ce30ebc77a31966dbd1d00 /ext/socket
parent268d1a2244b0179848a10a2841b4c037db52d3bd (diff)
* ext/socket/lib/socket.rb (family_addrinfo): don't require protocol
equality. For example, protocol 0 and IPPROTO_TCP is not problem for TCP. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/lib/socket.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb
index 3abbee8..10ab13b 100644
--- a/ext/socket/lib/socket.rb
+++ b/ext/socket/lib/socket.rb
@@ -17,7 +17,10 @@ class Addrinfo
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)
+ if (self.pfamily != addrinfo.pfamily) ||
+ (self.socktype != addrinfo.socktype)
+ raise ArgumentError, "Addrinfo type mismatch"
+ end
addrinfo
elsif self.ip?
raise ArgumentError, "IP address needs host and port but #{args.length} arguments given" if args.length != 2