diff options
author | eban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-07-12 06:16:49 +0000 |
---|---|---|
committer | eban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-07-12 06:16:49 +0000 |
commit | b8de25b4f1e2cc718a9e5055bc2801d9ced490b9 (patch) | |
tree | 20a3f5fc4f6f381c12ae9781a2ded1c584c90ea6 /ext | |
parent | 66f423c7bbbd241cf781fa2dce3c145018c631a3 (diff) |
* ext/socket/socket.c (ruby_connect): workaround for the setup of
Cygwin socket(EALREADY).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/socket/socket.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 684a408bd5..f10952ef4b 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -722,6 +722,9 @@ ruby_connect(fd, sockaddr, len, socks) { int status; int mode; +#if defined __CYGWIN__ + int wait_in_progress = -1; +#endif #if defined(HAVE_FCNTL) mode = fcntl(fd, F_GETFL, 0); @@ -757,17 +760,23 @@ ruby_connect(fd, sockaddr, len, socks) #ifdef EINPROGRESS case EINPROGRESS: #if defined __CYGWIN__ - { - struct timeval tv; - tv.tv_sec = 0; - tv.tv_usec = 100000; - rb_thread_wait_for(tv); - } + wait_in_progress = 10; #endif #endif thread_write_select(fd); continue; +#if defined __CYGWIN__ + case EALREADY: + case EINVAL: + if (--wait_in_progress > 0) { + struct timeval tv = {0, 100000}; + rb_thread_wait_for(tv); + continue; + } + break; +#endif + #ifdef EISCONN case EISCONN: status = 0; |