ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: ruby-core@ruby-lang.org
Cc: naruse@ruby-lang.org
Subject: [ruby-core:87425] Re: [ruby-cvs:70678] naruse:r63587 (trunk): Introduce write_timeout to Net::HTTP [Feature #13396]
Date: Wed, 6 Jun 2018 08:58:29 +0000	[thread overview]
Message-ID: <20180606085829.d4uumjwkgj2ksx4o@dcvr> (raw)
In-Reply-To: <20180606080347.D09C76B4F3@svn.ruby-lang.org>

naruse@ruby-lang.org wrote:
>   https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63587

For OpenSSL, I think you need to expect : wait_readable on
write_nonblock, too.


Anyways, the code for handling partial write_nonblock case is verbose.
One day, I would like to:

1) integrate Timeout into core
2) make all SOCK_STREAM sockets non-blocking by default
3) Make rb_wait_for_single_fd aware of Timeouts

So we can use:

    Timeout.timeout(@write_timeout) { @io.write(strs) }

And no new background threads get spawned.


P.S.: If Ruby were LGPL-2.1+, I would steal the ccan/timer module which
      is optimized for frequently-expiring timers and be done with 1),
      already.

       reply	other threads:[~2018-06-06  8:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180606080347.D09C76B4F3@svn.ruby-lang.org>
2018-06-06  8:58 ` Eric Wong [this message]
2018-06-18 23:06   ` [ruby-core:87509] timeout in core (was: naruse:r63587 (trunk): Introduce write_timeout to Net::HTTP [Feature #13396]) Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180606085829.d4uumjwkgj2ksx4o@dcvr \
    --to=ruby-core@ruby-lang.org \
    --cc=naruse@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).