How can an I use nonblocking I/O with openssl?

Discussion in 'Ruby' started by Yaxm Yaxm, Feb 6, 2009.

  1. Yaxm Yaxm

    Yaxm Yaxm Guest

    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
    --
    Posted via http://www.ruby-forum.com/.
    Yaxm Yaxm, Feb 6, 2009
    #1
    1. Advertising

  2. Yaxm Yaxm

    Tony Arcieri Guest

    [Note: parts of this message were removed to make it a legal post.]

    On Fri, Feb 6, 2009 at 11:45 AM, Yaxm Yaxm
    <<snowstorm%>
    > 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/5f76c67996fd9076503072cf569ad935423e9d56/ext/rev/rev_ssl.c

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

    --
    Tony Arcieri
    medioh.com
    Tony Arcieri, Feb 6, 2009
    #2
    1. Advertising

  3. Yaxm Yaxm

    Yaxm Yaxm Guest

    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 <> 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.


    --
    Posted via http://www.ruby-forum.com/.
    Yaxm Yaxm, Feb 7, 2009
    #3
  4. Yaxm Yaxm

    Tony Arcieri Guest

    [Note: parts of this message were removed to make it a legal post.]

    On Fri, Feb 6, 2009 at 10:00 PM, Yaxm Yaxm
    <<snowstorm%>
    > 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-to21885626.html

    And now installable as "gem install openssl-nonblock"

    Let me know if it works out for you.

    --
    Tony Arcieri
    medioh.com
    Tony Arcieri, Feb 7, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KimTaehwan

    setSoTimeout in nonblocking mode?

    KimTaehwan, Nov 16, 2003, in forum: Java
    Replies:
    0
    Views:
    1,134
    KimTaehwan
    Nov 16, 2003
  2. nonblocking sockets

    , Apr 7, 2006, in forum: Java
    Replies:
    2
    Views:
    1,088
    Gordon Beaton
    Apr 8, 2006
  3. Peter Ammon

    nonblocking read()

    Peter Ammon, Nov 16, 2004, in forum: Python
    Replies:
    3
    Views:
    544
    Donn Cave
    Nov 17, 2004
  4. rakaur
    Replies:
    4
    Views:
    588
    Bill Kelly
    Feb 14, 2006
  5. Redd Vinylene
    Replies:
    6
    Views:
    292
    Jakub Pawlowicz
    Nov 18, 2008
Loading...

Share This Page