On Sat, Mar 07, 2009 at 01:45:21PM -0500, Thor Lancelot Simon wrote:
[...]
I see two ways to handle this. One is with very, very nasty application
logic, and the other is to simply set two separate events with the SSL
fd, each waiting on EV_WRITE. So when the SSL fd comes ready for write --
I'd hope -- both my pending SSL_read() and my pending SSL_write() would
be invoked, each from a separate event's callback.
The first way is what you have to do with Libevent 1.4.x and earlier;
Libevent only supports one _pending_ event at a time per fd/operation
pair. In other words, it's okay to have two events set to watch
EV_WRITE on the same FD, but you can only ever add one at a time.
The application logic to handle this isn't actually so bad; instead of
having two events (one write, and one write in order to read),
have just one write for something event, and have your per-fd data
structure remember which underlying semantic events you actually
meant. The Tor source code does this if you want to check out an
open-source example of how it's possible; I'm sure there are other
good projects to check out too.
On the other hand, the development branch for Libevent 2.0 _does_
support multiple events per fd; if you're willing to use alpha code
until Libevent 2.0 stabilizes, that might be one way to go.
(I'd also like to get a bufferevent filter that handles openssl into
Libevent 2.0, but the implementation for that one isn't done yet.)
yrs,
--
Nick
___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users