[前][次][番号順一覧][スレッド一覧]

ruby-changes:29672

From: akr <ko1@a...>
Date: Mon, 1 Jul 2013 20:06:02 +0900 (JST)
Subject: [ruby-changes:29672] akr:r41724 (trunk): * ext/socket/ipsocket.c (init_inetsock_internal): Use an address

akr	2013-07-01 20:05:47 +0900 (Mon, 01 Jul 2013)

  New Revision: 41724

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41724

  Log:
    * ext/socket/ipsocket.c (init_inetsock_internal): Use an address
      family for local address wihch is different to the remote
      address if no other choice.

  Modified files:
    trunk/ChangeLog
    trunk/ext/socket/ipsocket.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41723)
+++ ChangeLog	(revision 41724)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Jul  1 20:03:39 2013  Tanaka Akira  <akr@f...>
+
+	* ext/socket/ipsocket.c (init_inetsock_internal): Use an address
+	  family for local address wihch is different to the remote
+	  address if no other choice.
+
 Mon Jul  1 15:05:00 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/csv.rb (CSV#<<): use StringIO#set_encoding instead of creating
Index: ext/socket/ipsocket.c
===================================================================
--- ext/socket/ipsocket.c	(revision 41723)
+++ ext/socket/ipsocket.c	(revision 41724)
@@ -68,8 +68,13 @@ init_inetsock_internal(struct inetsock_a https://github.com/ruby/ruby/blob/trunk/ext/socket/ipsocket.c#L68
                 if (lres->ai_family == res->ai_family)
                     break;
             }
-            if (!lres)
-                continue;
+            if (!lres) {
+                if (res->ai_next)
+                    continue;
+                /* Use a different family local address if no choice, this
+                 * will cause EAFNOSUPPORT. */
+                lres = arg->local.res;
+            }
         }
 	status = rsock_socket(res->ai_family,res->ai_socktype,res->ai_protocol);
 	syscall = "socket(2)";

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]