Forum: Ruby How can an I use nonblocking I/O with openssl?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ad68180beef0a583cd6c438de0fd4738?d=identicon&s=25 Yaxm Yaxm (yaxm)
on 2009-02-06 19:45
hello,
I am using ruby's imap library to connect to gmail via ssl.
But every now and then, my thread goes into sleep and never wakes up.
I suspect that the thread is waiting for I/O for reading.

how can I make openssl use nonblocking i/o?

here's another thread discussed about similar issue:
http://www.ruby-forum.com/topic/70716

Thanks.
Yaxm
2f55791ab9018b4d01fb741fab21843d?d=identicon&s=25 Tony Arcieri (Guest)
on 2009-02-06 19:50
(Received via mailing list)
On Fri, Feb 6, 2009 at 11:45 AM, Yaxm Yaxm
<snowstorm+rubyforum@gmail.com<snowstorm%2Brubyforum@gmail.com>
> wrote:

> hello,
> I am using ruby's imap library to connect to gmail via ssl.
> But every now and then, my thread goes into sleep and never wakes up.
> I suspect that the thread is waiting for I/O for reading.
>
> how can I make openssl use nonblocking i/o?
>

In my event library Rev (http://rev.rubyforge.org) I ended up
effectively
monkeypatching the C code in the Ruby OpenSSL extension in order to
support
non-blocking I/O:

http://github.com/tarcieri/rev/blob/5f76c67996fd90...

I for one would certainly appreciate a "real" solution to doing
non-blocking
SSL.
2f55791ab9018b4d01fb741fab21843d?d=identicon&s=25 Tony Arcieri (Guest)
on 2009-02-06 22:36
(Received via mailing list)
On Fri, Feb 6, 2009 at 11:50 AM, Tony Arcieri <tony@medioh.com> wrote:

> I for one would certainly appreciate a "real" solution to doing
> non-blocking SSL.
>

If there's interest I can release Rev's nonblocking SSL support as a
self-contained Gem which monkeypatches connect_nonblock,
accept_nonblock,
read_nonblock, and write_nonblock methods into OpenSSL::SSL::Socket.
Ad68180beef0a583cd6c438de0fd4738?d=identicon&s=25 Yaxm Yaxm (yaxm)
on 2009-02-07 06:00
I am very interested in as I need IMAP ssl to use non-blocking i/o.

Tony Arcieri wrote:
> On Fri, Feb 6, 2009 at 11:50 AM, Tony Arcieri <tony@medioh.com> wrote:
>
>> I for one would certainly appreciate a "real" solution to doing
>> non-blocking SSL.
>>
>
> If there's interest I can release Rev's nonblocking SSL support as a
> self-contained Gem which monkeypatches connect_nonblock,
> accept_nonblock,
> read_nonblock, and write_nonblock methods into OpenSSL::SSL::Socket.
2f55791ab9018b4d01fb741fab21843d?d=identicon&s=25 Tony Arcieri (Guest)
on 2009-02-07 07:53
(Received via mailing list)
On Fri, Feb 6, 2009 at 10:00 PM, Yaxm Yaxm
<snowstorm+rubyforum@gmail.com<snowstorm%2Brubyforum@gmail.com>
> wrote:

> I am very interested in as I need IMAP ssl to use non-blocking i/o.
>

All right, well I released non-blocking OpenSSL support as a gem.

github repo here:
http://github.com/tarcieri/openssl-nonblock/tree/master

release announcement here:
http://www.nabble.com/-ANN--openssl-nonblock-0.1.0...

And now installable as "gem install openssl-nonblock"

Let me know if it works out for you.
This topic is locked and can not be replied to.