aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-12-12 15:01:43 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-12-12 15:01:43 +0000
commita74aeeba59eb8cb0e90e748913219f2d829323ff (patch)
tree66d7660b2fed94dc47c9c88bc46da4ed807cc6d2 /src/core
parent4f57d54cb9c5fded88d7813d0c70ba3053bf803a (diff)
downloadgnunet-a74aeeba59eb8cb0e90e748913219f2d829323ff.tar.gz
gnunet-a74aeeba59eb8cb0e90e748913219f2d829323ff.zip
fix for core key exchange
Diffstat (limited to 'src/core')
-rw-r--r--src/core/gnunet-service-core_kx.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c
index 48e70eec5..b3fd7f3f6 100644
--- a/src/core/gnunet-service-core_kx.c
+++ b/src/core/gnunet-service-core_kx.c
@@ -676,15 +676,22 @@ GSC_KX_start (const struct GNUNET_PeerIdentity *pid)
676 GNUNET_CRYPTO_hash (pid, sizeof (struct GNUNET_PeerIdentity), &h1); 676 GNUNET_CRYPTO_hash (pid, sizeof (struct GNUNET_PeerIdentity), &h1);
677 GNUNET_CRYPTO_hash (&GSC_my_identity, sizeof (struct GNUNET_PeerIdentity), &h2); 677 GNUNET_CRYPTO_hash (&GSC_my_identity, sizeof (struct GNUNET_PeerIdentity), &h2);
678 678
679 kx->status = KX_STATE_KEY_SENT;
679 if (0 < GNUNET_CRYPTO_hash_cmp (&h1, 680 if (0 < GNUNET_CRYPTO_hash_cmp (&h1,
680 &h2)) 681 &h2))
681 { 682 {
682 /* peer with "lower" identity starts KX, otherwise we typically end up 683 /* peer with "lower" identity starts KX, otherwise we typically end up
683 with both peers starting the exchange and transmit the 'set key' 684 with both peers starting the exchange and transmit the 'set key'
684 message twice */ 685 message twice */
685 kx->status = KX_STATE_KEY_SENT;
686 send_key (kx); 686 send_key (kx);
687 } 687 }
688 else
689 {
690 /* peer with "higher" identity starts a delayed KX, if the "lower" peer
691 * does not start a KX since he sees no reasons to do so */
692 kx->retry_set_key_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
693 &set_key_retry_task, kx);
694 }
688 return kx; 695 return kx;
689} 696}
690 697