* ext/socket/socket.c (ruby_connect): connect() after EINPROGRESS
returns EINVAL on some platforms, need to check true error status. [ruby-core:01037] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6cbcafb9b9
commit
e9d1dd8388
12
ChangeLog
12
ChangeLog
@ -1,3 +1,9 @@
|
|||||||
|
Sat May 17 00:18:11 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||||
|
|
||||||
|
* ext/socket/socket.c (ruby_connect): connect() after EINPROGRESS
|
||||||
|
returns EINVAL on some platforms, need to check true error
|
||||||
|
status. [ruby-core:01037]
|
||||||
|
|
||||||
Fri May 16 12:40:40 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Fri May 16 12:40:40 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (block_pass): chain previous block to the pushing block.
|
* eval.c (block_pass): chain previous block to the pushing block.
|
||||||
@ -7,10 +13,10 @@ Fri May 16 12:40:40 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
|||||||
|
|
||||||
Thu May 15 21:55:54 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
|
Thu May 15 21:55:54 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
|
||||||
|
|
||||||
* lib/gram.c: fixes to one-line documents and end of stream documents.
|
* lib/gram.c: fixes to one-line documents and end of stream documents.
|
||||||
|
|
||||||
* lib/syck.c, lib/syck.h: add root_on_error to parser struct, specifying
|
* lib/syck.c, lib/syck.h: add root_on_error to parser struct, specifying
|
||||||
the symbol to be returned on a parse error.
|
the symbol to be returned on a parse error.
|
||||||
|
|
||||||
Thu May 15 18:44:31 2003 Tanaka Akira <akr@m17n.org>
|
Thu May 15 18:44:31 2003 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ bsock_getsockopt(sock, lev, optname)
|
|||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
bsock_getsockname(sock)
|
bsock_getsockname(sock)
|
||||||
VALUE sock;
|
VALUE sock;
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
socklen_t len = sizeof buf;
|
socklen_t len = sizeof buf;
|
||||||
@ -338,7 +338,7 @@ bsock_getsockname(sock)
|
|||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
bsock_getpeername(sock)
|
bsock_getpeername(sock)
|
||||||
VALUE sock;
|
VALUE sock;
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
socklen_t len = sizeof buf;
|
socklen_t len = sizeof buf;
|
||||||
@ -724,6 +724,13 @@ thread_write_select(fd)
|
|||||||
rb_thread_select(fd+1, 0, &fds, 0, 0);
|
rb_thread_select(fd+1, 0, &fds, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
#define WAIT_IN_PROGRESS 10
|
||||||
|
#endif
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#define WAIT_IN_PROGRESS 10
|
||||||
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ruby_connect(fd, sockaddr, len, socks)
|
ruby_connect(fd, sockaddr, len, socks)
|
||||||
int fd;
|
int fd;
|
||||||
@ -733,7 +740,7 @@ ruby_connect(fd, sockaddr, len, socks)
|
|||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
int mode;
|
int mode;
|
||||||
#if defined __CYGWIN__
|
#ifdef WAIT_IN_PROGRESS
|
||||||
int wait_in_progress = -1;
|
int wait_in_progress = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -770,20 +777,34 @@ ruby_connect(fd, sockaddr, len, socks)
|
|||||||
case EAGAIN:
|
case EAGAIN:
|
||||||
#ifdef EINPROGRESS
|
#ifdef EINPROGRESS
|
||||||
case EINPROGRESS:
|
case EINPROGRESS:
|
||||||
#ifdef __CYGWIN__
|
|
||||||
case EALREADY:
|
|
||||||
wait_in_progress = 10;
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef EALREADY
|
||||||
|
case EALREADY:
|
||||||
|
#endif
|
||||||
|
#ifdef WAIT_IN_PROGRESS
|
||||||
|
wait_in_progress = WAIT_IN_PROGRESS;
|
||||||
#endif
|
#endif
|
||||||
thread_write_select(fd);
|
thread_write_select(fd);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#if defined __CYGWIN__
|
#ifdef WAIT_IN_PROGRESS
|
||||||
case EINVAL:
|
case EINVAL:
|
||||||
if (wait_in_progress-- > 0) {
|
if (wait_in_progress-- > 0) {
|
||||||
struct timeval tv = {0, 100000};
|
int sockerr, sockerrlen = sizeof(sockerr);
|
||||||
rb_thread_wait_for(tv);
|
|
||||||
continue;
|
/*
|
||||||
|
* connect() after EINPROGRESS returns EINVAL on
|
||||||
|
* some platforms, need to check true error
|
||||||
|
* status.
|
||||||
|
*/
|
||||||
|
status = getsockopt(fd, SOL_SOCKET, SO_ERROR, &sockerr, &sockerrlen);
|
||||||
|
if (!status && !sockerr) {
|
||||||
|
struct timeval tv = {0, 100000};
|
||||||
|
rb_thread_wait_for(tv);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
status = -1;
|
||||||
|
errno = sockerr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@ -1891,7 +1912,7 @@ sock_bind(sock, addr)
|
|||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
sock_listen(sock, log)
|
sock_listen(sock, log)
|
||||||
VALUE sock, log;
|
VALUE sock, log;
|
||||||
{
|
{
|
||||||
OpenFile *fptr;
|
OpenFile *fptr;
|
||||||
|
|
||||||
@ -1914,7 +1935,7 @@ sock_recvfrom(argc, argv, sock)
|
|||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
sock_accept(sock)
|
sock_accept(sock)
|
||||||
VALUE sock;
|
VALUE sock;
|
||||||
{
|
{
|
||||||
OpenFile *fptr;
|
OpenFile *fptr;
|
||||||
VALUE sock2;
|
VALUE sock2;
|
||||||
@ -1929,7 +1950,7 @@ sock_accept(sock)
|
|||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
sock_sysaccept(sock)
|
sock_sysaccept(sock)
|
||||||
VALUE sock;
|
VALUE sock;
|
||||||
{
|
{
|
||||||
OpenFile *fptr;
|
OpenFile *fptr;
|
||||||
VALUE sock2;
|
VALUE sock2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user