diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | ext/socket/init.c | 8 |
2 files changed, 17 insertions, 2 deletions
@@ -1,3 +1,14 @@ +Fri Feb 21 23:47:24 2014 Shugo Maeda <shugo@ruby-lang.org> + + * 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@ruby-lang.org> * tool/redmine-backporter.rb: added to handle redmine tickets. diff --git a/ext/socket/init.c b/ext/socket/init.c index dc6b531bd6..f6cd2bce7b 100644 --- a/ext/socket/init.c +++ b/ext/socket/init.c @@ -364,8 +364,12 @@ wait_connectable(int fd) */ 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; |