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

ruby-changes:33005

From: shugo <ko1@a...>
Date: Fri, 21 Feb 2014 23:59:47 +0900 (JST)
Subject: [ruby-changes:33005] shugo:r45084 (trunk): * ext/socket/init.c (wait_connectable): break if the socket is

shugo	2014-02-21 23:59:44 +0900 (Fri, 21 Feb 2014)

  New Revision: 45084

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

  Log:
    * ext/socket/init.c (wait_connectable): break if the socket is
      writable to avoid infinite loops on FreeBSD and other platforms
      which conforms to SUSv3.  This problem cannot be reproduced with
      loopback interfaces, so it's hard to write test code.
      rsock_connect() and wait_connectable() are overly complicated, so
      they should be refactored, but I commit this fix as a workaround
      for the release of Ruby 1.9.3 scheduled on Feb 24.
      [ruby-core:60940] [Bug #9547]

  Modified files:
    trunk/ChangeLog
    trunk/ext/socket/init.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45083)
+++ ChangeLog	(revision 45084)
@@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Feb 21 23:47:24 2014  Shugo Maeda  <shugo@r...>
+
+	* ext/socket/init.c (wait_connectable): break if the socket is
+	  writable to avoid infinite loops on FreeBSD and other platforms
+	  which conforms to SUSv3.  This problem cannot be reproduced with
+	  loopback interfaces, so it's hard to write test code.
+	  rsock_connect() and wait_connectable() are overly complicated, so
+	  they should be refactored, but I commit this fix as a workaround
+	  for the release of Ruby 1.9.3 scheduled on Feb 24.
+	  [ruby-core:60940] [Bug #9547]
+
 Fri Feb 21 23:03:39 2014  NARUSE, Yui  <naruse@r...>
 
 	* tool/redmine-backporter.rb: added to handle redmine tickets.
Index: ext/socket/init.c
===================================================================
--- ext/socket/init.c	(revision 45083)
+++ ext/socket/init.c	(revision 45084)
@@ -364,8 +364,12 @@ wait_connectable(int fd) https://github.com/ruby/ruby/blob/trunk/ext/socket/init.c#L364
 	     */
 	    if (ret < 0)
 		break;
-	    if (sockerr == 0)
-		continue;	/* workaround for winsock */
+	    if (sockerr == 0) {
+		if (revents & RB_WAITFD_OUT)
+		    break;
+		else
+		    continue;	/* workaround for winsock */
+	    }
 
 	    /* BSD and Linux use sockerr. */
 	    errno = sockerr;

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

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