mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/socket/{basicksocket,init,udpsocket}.c: revert some parts of
r36944. it breaks mswin/mingw ruby and brought into many many crashes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7d59a96314
commit
91987f6b04
3 changed files with 5 additions and 1 deletions
|
@ -558,7 +558,8 @@ rsock_bsock_send(int argc, VALUE *argv, VALUE sock)
|
||||||
GetOpenFile(sock, fptr);
|
GetOpenFile(sock, fptr);
|
||||||
arg.fd = fptr->fd;
|
arg.fd = fptr->fd;
|
||||||
arg.flags = NUM2INT(flags);
|
arg.flags = NUM2INT(flags);
|
||||||
while ((n = (int)BLOCKING_REGION_FD(func, &arg)) < 0) {
|
while (rb_thread_fd_writable(arg.fd),
|
||||||
|
(n = (int)BLOCKING_REGION_FD(func, &arg)) < 0) {
|
||||||
if (rb_io_wait_writable(arg.fd)) {
|
if (rb_io_wait_writable(arg.fd)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,6 +130,7 @@ rsock_s_recvfrom(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
|
||||||
RBASIC(str)->klass = 0;
|
RBASIC(str)->klass = 0;
|
||||||
|
|
||||||
while (rb_io_check_closed(fptr),
|
while (rb_io_check_closed(fptr),
|
||||||
|
rb_thread_wait_fd(arg.fd),
|
||||||
(slen = BLOCKING_REGION_FD(recvfrom_blocking, &arg)) < 0) {
|
(slen = BLOCKING_REGION_FD(recvfrom_blocking, &arg)) < 0) {
|
||||||
if (!rb_io_wait_readable(fptr->fd)) {
|
if (!rb_io_wait_readable(fptr->fd)) {
|
||||||
rb_sys_fail("recvfrom(2)");
|
rb_sys_fail("recvfrom(2)");
|
||||||
|
@ -559,6 +560,7 @@ rsock_s_accept(VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len)
|
||||||
arg.sockaddr = sockaddr;
|
arg.sockaddr = sockaddr;
|
||||||
arg.len = len;
|
arg.len = len;
|
||||||
retry:
|
retry:
|
||||||
|
rb_thread_wait_fd(fd);
|
||||||
fd2 = (int)BLOCKING_REGION_FD(accept_blocking, &arg);
|
fd2 = (int)BLOCKING_REGION_FD(accept_blocking, &arg);
|
||||||
if (fd2 < 0) {
|
if (fd2 < 0) {
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
|
|
|
@ -176,6 +176,7 @@ udp_send(int argc, VALUE *argv, VALUE sock)
|
||||||
retry:
|
retry:
|
||||||
arg.to = res->ai_addr;
|
arg.to = res->ai_addr;
|
||||||
arg.tolen = res->ai_addrlen;
|
arg.tolen = res->ai_addrlen;
|
||||||
|
rb_thread_fd_writable(arg.fd);
|
||||||
n = (int)BLOCKING_REGION_FD(rsock_sendto_blocking, &arg);
|
n = (int)BLOCKING_REGION_FD(rsock_sendto_blocking, &arg);
|
||||||
if (n >= 0) {
|
if (n >= 0) {
|
||||||
freeaddrinfo(res0);
|
freeaddrinfo(res0);
|
||||||
|
|
Loading…
Reference in a new issue