summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--ext/socket/lib/socket.rb5
2 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9273e09dc9f..7862f89d7d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Mon Jan 9 20:14:13 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/lib/socket.rb (family_addrinfo): don't require protocol
+ equality. For example, protocol 0 and IPPROTO_TCP is not problem
+ for TCP.
+
Mon Jan 9 20:08:52 2012 Tanaka Akira <akr@fsij.org>
* ext/socket/lib/socket.rb (family_addrinfo): return the given
diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb
index 3abbee83179..10ab13b953f 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