summaryrefslogtreecommitdiff
path: root/src/revocation/gnunet-service-revocation.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-03-20 23:29:14 +0000
committerChristian Grothoff <christian@grothoff.org>2015-03-20 23:29:14 +0000
commitddc55c4321748e6f39b229d0993479f25b62984c (patch)
treef90ef289e05819260a32941007d416b5c286b6d7 /src/revocation/gnunet-service-revocation.c
parent5bcc3793bcec0ab29d0cb67344f43683855df0c3 (diff)
fix #3721
Diffstat (limited to 'src/revocation/gnunet-service-revocation.c')
-rw-r--r--src/revocation/gnunet-service-revocation.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c
index 0e3e6c5af..f5ed5fcbc 100644
--- a/src/revocation/gnunet-service-revocation.c
+++ b/src/revocation/gnunet-service-revocation.c
@@ -512,14 +512,27 @@ handle_core_connect (void *cls,
struct GNUNET_HashCode my_hash;
struct GNUNET_HashCode peer_hash;
- if (0 == memcmp(peer,
- &my_identity,
- sizeof (my_identity)))
- return;
+ if (0 == memcmp (peer,
+ &my_identity,
+ sizeof (my_identity)))
+ {
+ GNUNET_break (0);
+ return;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer `%s' connected to us\n",
GNUNET_i2s (peer));
+ peer_entry = GNUNET_CONTAINER_multipeermap_get (peers,
+ peer);
+ if (NULL != peer_entry)
+ {
+ /* This can happen if "core"'s notification is a tad late
+ and CADET+SET were faster and already produced a
+ #handle_revocation_union_request() for us to deal
+ with. This should be rare, but isn't impossible. */
+ return;
+ }
peer_entry = GNUNET_new (struct PeerEntry);
peer_entry->id = *peer;
GNUNET_assert (GNUNET_OK ==
@@ -568,7 +581,10 @@ handle_core_disconnect (void *cls,
if (0 == memcmp (peer,
&my_identity,
sizeof (my_identity)))
+ {
+ GNUNET_break (0);
return;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer `%s' disconnected from us\n",
@@ -728,7 +744,8 @@ handle_revocation_union_request (void *cls,
peer_entry = GNUNET_new (struct PeerEntry);
peer_entry->id = *other_peer;
GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multipeermap_put (peers, other_peer,
+ GNUNET_CONTAINER_multipeermap_put (peers,
+ other_peer,
peer_entry,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
}