Module: sip-router
Branch: andrei/tcp_tls_changes
Commit: 813284bad28a11c985cbd4ce370fdee98c815e88
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=813284b…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Jul 9 20:03:45 2010 +0200
tls: partial SSL_write support when reading (tls_read_f)
When writing-on-read (due to queued send data waiting for a
renegotiation to complete), retry the write if it did not have
enough buffer space to complete (after freeing the buffer space by
tcp_send-ing its content).
---
modules/tls/tls_server.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/modules/tls/tls_server.c b/modules/tls/tls_server.c
index 8d45b53..122141e 100644
--- a/modules/tls/tls_server.c
+++ b/modules/tls/tls_server.c
@@ -1151,9 +1151,15 @@ ssl_read_skipped:
}
goto end; /* no more data to read */
case SSL_ERROR_WANT_WRITE:
- /* write buffer too small, nothing written */
+ if (wr.used) {
+ /* something was written => buffer not big enough to hold
+ everything => reset buffer & retry (the tcp_write already
+ happened if we are here) */
+ goto continue_ssl_read;
+ }
+ /* else write buffer too small, nothing written */
BUG("write buffer too small (%d/%d bytes)\n",
- wr.used, wr.size);
+ wr.used, wr.size);
goto bug;
case SSL_ERROR_SSL:
/* protocol level error */