# HG changeset patch # User Sebastien Decugis # Date 1371692527 -28800 # Node ID 835fe2345db672edb7f7c44dac74b8558ed50c53 # Parent 1804ef0240cc4698862469859164df3d03e0dbe0 Update send logic per Nikos Mavrogiannopoulos comments diff -r 1804ef0240cc -r 835fe2345db6 libfdcore/sctp_dtls.c --- a/libfdcore/sctp_dtls.c Thu Jun 20 09:38:52 2013 +0800 +++ b/libfdcore/sctp_dtls.c Thu Jun 20 09:42:07 2013 +0800 @@ -671,7 +671,9 @@ TRACE_DEBUG(FULL, "Thread terminated"); return NULL; -} +} + + /* Send a new Diameter message over the association */ int fd_sctp_dtls_send(struct cnxctx * conn, unsigned char * buf, size_t len) @@ -696,7 +698,10 @@ /* Now send the data over this stream. Do it in a loop in case the length is larger than the MTU */ do { - CHECK_GNUTLS_DO( ret = fd_tls_send_handle_error(conn, conn->cc_tls_para.session, buf + sent, len - sent), ); + size_t tosend = len - sent; + if (tosend > DTLS_SCTP_MTU) + tosend = DTLS_SCTP_MTU; + CHECK_GNUTLS_DO( ret = fd_tls_send_handle_error(conn, conn->cc_tls_para.session, buf + sent, tosend), ); if (ret <= 0) return ENOTCONN;