Add IO#timeout attribute and use it for blocking IO operations. (#5653)

This commit is contained in:
Samuel Williams 2022-10-07 21:48:38 +13:00 committed by GitHub
parent e76217a7f3
commit e4f91bbdba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2022-10-07 17:49:02 +09:00
Merged-By: ioquatix <samuel@codeotaku.com>
17 changed files with 428 additions and 99 deletions

View file

@ -1285,7 +1285,7 @@ bsock_sendmsg_internal(VALUE sock, VALUE data, VALUE vflags,
if (ss == -1) {
int e;
if (!nonblock && rb_io_maybe_wait_writable(errno, fptr->self, Qnil)) {
if (!nonblock && rb_io_maybe_wait_writable(errno, fptr->self, fptr->timeout)) {
rb_io_check_closed(fptr);
goto retry;
}
@ -1557,7 +1557,7 @@ bsock_recvmsg_internal(VALUE sock,
if (ss == -1) {
int e;
if (!nonblock && rb_io_maybe_wait_readable(errno, fptr->self, Qnil)) {
if (!nonblock && rb_io_maybe_wait_readable(errno, fptr->self, fptr->timeout)) {
rb_io_check_closed(fptr);
goto retry;
}