+/**
+ * Transmit our current typemap message to the other peer.
+ * (Done periodically in case an update got lost).
+ *
+ * @param cls the 'struct Session*'
+ * @param tc unused
+ */
+static void
+transmit_typemap_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ struct Session *session = cls;
+ struct GNUNET_MessageHeader *hdr;
+ struct GNUNET_TIME_Relative delay;
+
+ delay = TYPEMAP_FREQUENCY;
+ /* randomize a bit to avoid spont. sync */
+ delay.rel_value +=
+ GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000);
+ session->typemap_task =
+ GNUNET_SCHEDULER_add_delayed (delay, &transmit_typemap_task, session);
+ GNUNET_STATISTICS_update (GSC_stats,
+ gettext_noop ("# type map refreshes sent"), 1,
+ GNUNET_NO);
+ hdr = GSC_TYPEMAP_compute_type_map_message ();
+ GSC_KX_encrypt_and_transmit (session->kxinfo, hdr, ntohs (hdr->size));
+ GNUNET_free (hdr);
+}
+
+