mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-08 11:53:00 -04:00
Change bufferevent_openssl::do_write so it doesn't call SSL_write with a 0 length buffer
I was running into a problem when using bufferevent_openssl with a very simple echo server. My server simply bufferevent_read_buffer 'd data into an evbuffer and then passed that evbuffer straight to bufferevent_write_buffer. The problem was every now and again the write would fail for no apparent reason. I tracked it down to SSL_write being called with the amount of data to send being 0. This patch alters do_write in bufferevent_openssl so that it skips io_vecs with 0 length.
This commit is contained in:
parent
7c926916b2
commit
c991317409
@ -617,6 +617,12 @@ do_write(struct bufferevent_openssl *bev_ssl, int atmost)
|
||||
if (bev_ssl->bev.write_suspended)
|
||||
break;
|
||||
|
||||
/* SSL_write will (reasonably) return 0 if we tell it to
|
||||
send 0 data. Skip this case so we don't interpret the
|
||||
result as an error */
|
||||
if (space[i].iov_len == 0)
|
||||
continue;
|
||||
|
||||
r = SSL_write(bev_ssl->ssl, space[i].iov_base,
|
||||
space[i].iov_len);
|
||||
if (r > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user