From e4894bfd0b8abf1eedae839413d81b84ea470903 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Wed, 25 Nov 2015 11:10:42 -0800 Subject: [PATCH] add comments to clarify accept and connect state advancement due to sending fragments --- src/ssl.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index 2fba69bd6..e895a3f90 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -5695,9 +5695,17 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl, if (ssl->buffers.outputBuffer.length > 0) { if ( (ssl->error = SendBuffered(ssl)) == 0) { + /* fragOffset is non-zero when sending fragments. On the last + * fragment, fragOffset is zero again, and the state can be + * advanced. */ if (ssl->fragOffset == 0) { ssl->options.connectState++; - WOLFSSL_MSG("connect state: Advanced from buffered send"); + WOLFSSL_MSG("connect state: " + "Advanced from last buffered fragment send"); + } + else { + WOLFSSL_MSG("connect state: " + "Not advanced, more fragments to send"); } } else { @@ -6013,9 +6021,17 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl, if (ssl->buffers.outputBuffer.length > 0) { if ( (ssl->error = SendBuffered(ssl)) == 0) { + /* fragOffset is non-zero when sending fragments. On the last + * fragment, fragOffset is zero again, and the state can be + * advanced. */ if (ssl->fragOffset == 0) { ssl->options.acceptState++; - WOLFSSL_MSG("accept state: Advanced from buffered send"); + WOLFSSL_MSG("accept state: " + "Advanced from last buffered fragment send"); + } + else { + WOLFSSL_MSG("accept state: " + "Not advanced, more fragments to send"); } } else {