1. Implemented the SCTP MTU size changes for transmit.

2. Simplified the MAX_FRAGMENT size when calling SendData().
This commit is contained in:
John Safranek
2016-08-24 18:26:17 -07:00
parent a6c0d4fed7
commit bab071f961

View File

@@ -10834,14 +10834,10 @@ int SendData(WOLFSSL* ssl, const void* data, int sz)
#endif #endif
for (;;) { for (;;) {
#ifdef HAVE_MAX_FRAGMENT int len;
int len = min(sz - sent, min(ssl->max_fragment, OUTPUT_RECORD_SIZE));
#else
int len = min(sz - sent, OUTPUT_RECORD_SIZE);
#endif
byte* out; byte* out;
byte* sendBuffer = (byte*)data + sent; /* may switch on comp */ byte* sendBuffer = (byte*)data + sent; /* may switch on comp */
int buffSz = len; /* may switch on comp */ int buffSz; /* may switch on comp */
int outputSz; int outputSz;
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
byte comp[MAX_RECORD_SIZE + MAX_COMP_EXTRA]; byte comp[MAX_RECORD_SIZE + MAX_COMP_EXTRA];
@@ -10849,12 +10845,17 @@ int SendData(WOLFSSL* ssl, const void* data, int sz)
if (sent == sz) break; if (sent == sz) break;
len = min(sz - sent, OUTPUT_RECORD_SIZE);
#ifdef HAVE_MAX_FRAGMENT
len = min(len, ssl->max_fragment);
#endif
#ifdef WOLFSSL_DTLS #ifdef WOLFSSL_DTLS
if (ssl->options.dtls) { if (IsDtlsNotSctpMode(ssl)) {
len = min(len, MAX_UDP_SIZE); len = min(len, MAX_UDP_SIZE);
buffSz = len;
} }
#endif #endif
buffSz = len;
/* check for available size */ /* check for available size */
outputSz = len + COMP_EXTRA + dtlsExtra + MAX_MSG_EXTRA; outputSz = len + COMP_EXTRA + dtlsExtra + MAX_MSG_EXTRA;