From: Tony Arcieri Date: 2009-03-11T06:55:05+09:00 Subject: [ruby-core:22830] Re: [Bug #814] NoMethodError: undefined method `read_nonblock' for # --0015174c0e8cb236da0464cad42d Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Tue, Mar 10, 2009 at 2:29 AM, Tanaka Akira wrote: > Errno::EWOULDBLOCK exception extended by IO::WandRead (or > IO::WantWrite) is compatible with current ruby and > distinguishable with rescue clause. > > begin > io_or_ssl.read_nonblock(10) > rescue IO::WantRead > IO.select([io_or_ssl]) > retry > rescue IO::WantWrite > IO.select(nil, [io_or_ssl]) > retry > end > > IO::WantRead and IO::WantWrite also helps non-SSL > nonblocking IO because we don't need to list several > exceptions as Errno::EAGAIN, Errno::EWOULDBLOCK. > > It is not committed because Martin said the names are not > good. > All right, as soon as you've finalized the exception names I will use those in openssl-nonblock in lieu of my current ones and make them both descend from Errno::EWOULDBLOCK My exceptions were called ReadAgain and WriteAgain. Perhaps those would be better names? (although perhaps a bit confusing if descending from Errno::EWOULDBLOCK as opposed to Errno::EAGAIN) After that I can put together a patch and test the cases you're describing. -- Tony Arcieri --0015174c0e8cb236da0464cad42d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Tue, Mar 10, 2009 at 2:29 AM, Tanaka Akira <akr@fsij.org> wrote:
Errno::EWOULDBLOCK exception extended by IO::WandRead (or
IO::WantWrite) is compatible with current ruby and
distinguishable with rescue clause.

=A0begin
=A0 =A0io_or_ssl.read_nonblock(10)
=A0rescue IO::WantRead
=A0 =A0IO.select([io_or_ssl])
=A0 =A0retry
=A0rescue IO::WantWrite
=A0 =A0IO.select(nil, [io_or_ssl])
=A0 =A0retry
=A0end

IO::WantRead and IO::WantWrite also helps non-SSL
nonblocking IO because we don't need to list several
exceptions as Errno::EAGAIN, Errno::EWOULDBLOCK.

It is not committed because Martin said the names are not
good.

All right, as soon as you've finalized the excep= tion names I will use those in openssl-nonblock in lieu of my current ones = and make them both descend from Errno::EWOULDBLOCK

My exceptions wer= e called ReadAgain and WriteAgain.=A0 Perhaps those would be better names? = (although perhaps a bit confusing if descending from Errno::EWOULDBLOCK as = opposed to Errno::EAGAIN)

After that I can put together a patch and test the cases you're des= cribing.

--
Tony Arcieri
--0015174c0e8cb236da0464cad42d--