[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] bufferevent_openssl: readcb not always called for last partial read



On Tue, Aug 21, 2012 at 11:02 PM, Hochhaus, Andrew
<ahochhaus@xxxxxxxxxxxx> wrote:
> Hello,
>
> In libevent-2.0.19-stable, do_read can return 0 (stalled) when some
> progress has been made reading. This can occur, for example, when
> space[0].iov_len > 0 and the 2nd read attempt returns
> SSL_ERROR_WANT_READ. Then consider_reading may not call
> _bufferevent_run_readcb if no additional data arrives.
>
> Should do_read return 1 (progress) if it makes any progress at all?

Hm.  Looking at how the output is used, I think that the tristate
output format is probably a mistake.  It wants to return both "did I
read any data" *and* "am I now blocked", but the current interface
can't express "I read some data and then I got blocked."

Also it looks like do_write has a similar misdesign, though the users
of that function don't actually care.

How do you like the looks of the attached patch?

-- 
Nick

Attachment: 0001-Correctly-invoke-callbacks-when-a-SSL-bufferevent-re.patch
Description: Binary data