Mercurial > hg > freeDiameter-dtls
comparison libfdcore/sctp_dtls.c @ 1227:33b94b5b8289
Use path_mtu instead of MTU. Now large packets exchange are successful.
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Thu, 20 Jun 2013 09:55:03 +0800 |
parents | 835fe2345db6 |
children |
comparison
equal
deleted
inserted
replaced
1226:835fe2345db6 | 1227:33b94b5b8289 |
---|---|
678 /* Send a new Diameter message over the association */ | 678 /* Send a new Diameter message over the association */ |
679 int fd_sctp_dtls_send(struct cnxctx * conn, unsigned char * buf, size_t len) | 679 int fd_sctp_dtls_send(struct cnxctx * conn, unsigned char * buf, size_t len) |
680 { | 680 { |
681 ssize_t ret; | 681 ssize_t ret; |
682 size_t sent = 0; | 682 size_t sent = 0; |
683 size_t maxlen = gnutls_dtls_get_data_mtu(conn->cc_tls_para.session); | |
683 TRACE_ENTRY("%p %p %zd", conn, buf, len); | 684 TRACE_ENTRY("%p %p %zd", conn, buf, len); |
684 | 685 |
685 CHECK_PARAMS(conn); | 686 CHECK_PARAMS(conn); |
686 | 687 |
687 /* First, decide which stream this data will be sent to */ | 688 /* First, decide which stream this data will be sent to */ |
697 } | 698 } |
698 | 699 |
699 /* Now send the data over this stream. Do it in a loop in case the length is larger than the MTU */ | 700 /* Now send the data over this stream. Do it in a loop in case the length is larger than the MTU */ |
700 do { | 701 do { |
701 size_t tosend = len - sent; | 702 size_t tosend = len - sent; |
702 if (tosend > DTLS_SCTP_MTU) | 703 if (tosend > maxlen) |
703 tosend = DTLS_SCTP_MTU; | 704 tosend = maxlen; |
704 CHECK_GNUTLS_DO( ret = fd_tls_send_handle_error(conn, conn->cc_tls_para.session, buf + sent, tosend), ); | 705 CHECK_GNUTLS_DO( ret = fd_tls_send_handle_error(conn, conn->cc_tls_para.session, buf + sent, tosend), ); |
705 if (ret <= 0) | 706 if (ret <= 0) |
706 return ENOTCONN; | 707 return ENOTCONN; |
707 | 708 |
708 sent += ret; | 709 sent += ret; |