aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-03-03 08:14:37 +0000
committerChristian Grothoff <christian@grothoff.org>2013-03-03 08:14:37 +0000
commit6145ab509a3036b17f350b0dc2c0e2c6edd9c96b (patch)
treebf73e06b43632f0f58ab1e7296ab7e97f25e681e /src/core
parentb336a3030187b189cfc9b11f9ee1362054616a4b (diff)
downloadgnunet-6145ab509a3036b17f350b0dc2c0e2c6edd9c96b.tar.gz
gnunet-6145ab509a3036b17f350b0dc2c0e2c6edd9c96b.zip
reduce messages in initial KX
Diffstat (limited to 'src/core')
-rw-r--r--src/core/gnunet-service-core_kx.c11
-rw-r--r--src/core/gnunet-service-core_sessions.c7
-rw-r--r--src/core/gnunet-service-core_typemap.c2
3 files changed, 17 insertions, 3 deletions
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c
index 07f51cb49..d5e8a20d4 100644
--- a/src/core/gnunet-service-core_kx.c
+++ b/src/core/gnunet-service-core_kx.c
@@ -671,8 +671,15 @@ GSC_KX_start (const struct GNUNET_PeerIdentity *pid)
671 GNUNET_CONTAINER_DLL_insert (kx_head, 671 GNUNET_CONTAINER_DLL_insert (kx_head,
672 kx_tail, 672 kx_tail,
673 kx); 673 kx);
674 kx->status = KX_STATE_KEY_SENT; 674 if (0 < GNUNET_CRYPTO_hash_cmp (&pid->hashPubKey,
675 send_key (kx); 675 &GSC_my_identity.hashPubKey))
676 {
677 /* peer with "lower" identity starts KX, otherwise we typically end up
678 with both peers starting the exchange and transmit the 'set key'
679 message twice */
680 kx->status = KX_STATE_KEY_SENT;
681 send_key (kx);
682 }
676 return kx; 683 return kx;
677} 684}
678 685
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c
index bea4aad56..7316f4b25 100644
--- a/src/core/gnunet-service-core_sessions.c
+++ b/src/core/gnunet-service-core_sessions.c
@@ -37,6 +37,11 @@
37 */ 37 */
38#define TYPEMAP_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) 38#define TYPEMAP_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
39 39
40/**
41 * How often do we transmit our typemap on first attempt?
42 */
43#define TYPEMAP_FREQUENCY_FIRST GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
44
40 45
41/** 46/**
42 * Message ready for encryption. This struct is followed by the 47 * Message ready for encryption. This struct is followed by the
@@ -227,7 +232,7 @@ transmit_typemap_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
227 232
228 if (0 == session->first_typemap) 233 if (0 == session->first_typemap)
229 { 234 {
230 delay = GNUNET_TIME_UNIT_ZERO; 235 delay = TYPEMAP_FREQUENCY_FIRST;
231 session->first_typemap = 1; 236 session->first_typemap = 1;
232 } 237 }
233 else 238 else
diff --git a/src/core/gnunet-service-core_typemap.c b/src/core/gnunet-service-core_typemap.c
index d2dab5d99..627363b34 100644
--- a/src/core/gnunet-service-core_typemap.c
+++ b/src/core/gnunet-service-core_typemap.c
@@ -146,6 +146,8 @@ broadcast_my_type_map ()
146{ 146{
147 struct GNUNET_MessageHeader *hdr; 147 struct GNUNET_MessageHeader *hdr;
148 148
149 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
150 "broadcasting typemap\n");
149 hdr = GSC_TYPEMAP_compute_type_map_message (); 151 hdr = GSC_TYPEMAP_compute_type_map_message ();
150 GNUNET_STATISTICS_update (GSC_stats, 152 GNUNET_STATISTICS_update (GSC_stats,
151 gettext_noop ("# updates to my type map"), 1, 153 gettext_noop ("# updates to my type map"), 1,