From 7229ad68ab9ae4e70ac21b5648f8150896c30f32 Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Mon, 3 Aug 2009 19:54:28 +0200 Subject: [PATCH] Make sure we send with the same arguments again if SSL_write() fails with SSL_ERROR_WANT_READ. --- src/network/connection.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/network/connection.c b/src/network/connection.c index 0b6ea6f..e44c3e3 100644 --- a/src/network/connection.c +++ b/src/network/connection.c @@ -221,15 +221,20 @@ ssize_t net_con_send(struct net_connection* con, const void* buf, size_t len) } else { + if (net_con_flag_get(con, NET_WANT_SSL_READ) && con->write_len) + len = con->write_len; + int ret = SSL_write(con->ssl, buf, len); LOG_DEBUG("net_send: ret=%d", ret); if (ret > 0) { con->last_send = time(0); net_con_flag_unset(con, NET_WANT_SSL_READ); + con->write_len = 0; } else { + con->write_len = len; return handle_openssl_error(con, ret); } return ret;