Fix retransmission according to RFC
authorDmitriy Zhuravlev <d.zhuravlev@samsung.com>
Fri, 27 May 2016 14:10:09 +0000 (17:10 +0300)
committerRandeep Singh <randeep.s@samsung.com>
Thu, 2 Jun 2016 13:44:20 +0000 (13:44 +0000)
commita532c83b296610aa69a072ad78a2251759a50714
tree04a56a7a2ec3e688bca6e18a82924c63f1859d39
parent517b0a28fce622e62e07fee54ddf97224de9a8b1
Fix retransmission according to RFC

tinyDTLS does not satisfy RFC (https://tools.ietf.org/html/rfc6347):
1. "Partial reads (whether partial messages or only some of the messages
   in the flight) do not cause state transitions or timer resets.
2. "In addition, for at least twice the default MSL defined for [TCP],
   when in the FINISHED state, the node that transmits the last flight
   (the server in an ordinary handshake or the client in a resumed
   handshake) MUST respond to a retransmit of the peer's last flight"

List of changes:
1. Changed 'dtls_stop_retransmission' function. It clears timer only.
   Needed to save server's last flight in retransmission buffer.
2. Added 'dtls_start_retransmission' function. It can resume the
   retransmission after 'dtls_stop_retransmission'.
   Needed for responding to the client's last flight in FINISHED state.
3. New function 'dtls_clear_retransmission' clears retransmission buffer
   instead of 'dtls_stop_retransmission'.
4. Disabled clearing retransmission buffer in case of partial flight
   in 'handle_handshake_msg' function.
5. Added answering HELLO_VERIFY_REQUEST if client retransmit CLIENT_HELLO
   in 'handle_handshake_msg' function.

Change-Id: Ief775733e52a0e5f2e663b0317ed3f922bd92629
Signed-off-by: Dmitriy Zhuravlev <d.zhuravlev@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/8371
Reviewed-by: Craig Pratt <craig@ecaspia.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Randeep Singh <randeep.s@samsung.com>
extlibs/tinydtls/dtls.c