dtls.c: move debug output

Moved debug output after rewriting to see what get sent.

Change-Id: Iad414b9626b249860a53d83bd8fdb8421bac661f
diff --git a/dtls.c b/dtls.c
index ca50745..422ddba 100644
--- a/dtls.c
+++ b/dtls.c
@@ -1561,11 +1561,6 @@
   /* if (peer && MUST_HASH(peer, type, buf, buflen)) */
   /*   update_hs_hash(peer, buf, buflen); */
 
-  dtls_debug_hexdump("send header", sendbuf, sizeof(dtls_record_header_t));
-  for (i = 0; i < buf_array_len; i++) {
-    dtls_debug_hexdump("send unencrypted", buf_array[i], buf_len_array[i]);
-    overall_len += buf_len_array[i];
-  }
 
   /* Signal DTLS version 1.0 in the record layer of ClientHello and
    * HelloVerifyRequest handshake messages according to Section 4.2.1
@@ -1578,6 +1573,12 @@
     }
   }
 
+  dtls_debug_hexdump("send header", sendbuf, sizeof(dtls_record_header_t));
+  for (i = 0; i < buf_array_len; i++) {
+    dtls_debug_hexdump("send unencrypted", buf_array[i], buf_len_array[i]);
+    overall_len += buf_len_array[i];
+  }
+
   if ((type == DTLS_CT_HANDSHAKE && buf_array[0][0] != DTLS_HT_HELLO_VERIFY_REQUEST) ||
       type == DTLS_CT_CHANGE_CIPHER_SPEC) {
     /* copy handshake messages other than HelloVerify into retransmit buffer */