aboutsummaryrefslogtreecommitdiff
path: root/src/social
diff options
context:
space:
mode:
authorlurchi <lurchi@strangeplace.net>2018-02-02 19:39:30 +0100
committerlurchi <lurchi@strangeplace.net>2018-02-02 19:39:30 +0100
commit1c2e854307c0bfae10cf3057ffcbd18a922ccab9 (patch)
tree6b9280b3b8596e586791e7bcff470a8be4ac57f7 /src/social
parentdccb61ecfa50bf3bbf8ff31576c45740e291096d (diff)
downloadgnunet-1c2e854307c0bfae10cf3057ffcbd18a922ccab9.tar.gz
gnunet-1c2e854307c0bfae10cf3057ffcbd18a922ccab9.zip
consider deletion of egos we don't know; make code less obscure
Diffstat (limited to 'src/social')
-rw-r--r--src/social/gnunet-service-social.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/social/gnunet-service-social.c b/src/social/gnunet-service-social.c
index 21158acd5..bac08ae9d 100644
--- a/src/social/gnunet-service-social.c
+++ b/src/social/gnunet-service-social.c
@@ -3599,30 +3599,34 @@ identity_recv_ego (void *cls, struct GNUNET_IDENTITY_Ego *id_ego,
3599 GNUNET_CRYPTO_hash (&ego_pub_key, sizeof (ego_pub_key), &ego_pub_hash); 3599 GNUNET_CRYPTO_hash (&ego_pub_key, sizeof (ego_pub_key), &ego_pub_hash);
3600 3600
3601 struct Ego *ego = GNUNET_CONTAINER_multihashmap_get (egos, &ego_pub_hash); 3601 struct Ego *ego = GNUNET_CONTAINER_multihashmap_get (egos, &ego_pub_hash);
3602 if (NULL == ego && NULL == name)
3603 {
3604 // an ego that is none of our business has been deleted
3605 return;
3606 }
3602 if (NULL != ego) 3607 if (NULL != ego)
3603 { 3608 {
3609 // one of our egos has been changed
3604 GNUNET_free (ego->name); 3610 GNUNET_free (ego->name);
3605 if (NULL == name) // deleted 3611 if (NULL == name)
3606 { 3612 {
3613 // one of our egos has been deleted
3607 GNUNET_CONTAINER_multihashmap_remove (egos, &ego_pub_hash, ego); 3614 GNUNET_CONTAINER_multihashmap_remove (egos, &ego_pub_hash, ego);
3608 GNUNET_free (ego); 3615 GNUNET_free (ego);
3609 ego = NULL; 3616 return;
3610 } 3617 }
3611 } 3618 }
3612 else 3619 else
3613 { 3620 {
3614 ego = GNUNET_malloc (sizeof (*ego)); 3621 ego = GNUNET_malloc (sizeof (*ego));
3615 } 3622 }
3616 if (NULL != ego) 3623 ego->key = *(GNUNET_IDENTITY_ego_get_private_key (id_ego));
3617 { 3624 size_t name_size = strlen (name) + 1;
3618 ego->key = *(GNUNET_IDENTITY_ego_get_private_key (id_ego)); 3625 ego->name = GNUNET_malloc (name_size);
3619 size_t name_size = strlen (name) + 1; 3626 GNUNET_memcpy (ego->name, name, name_size);
3620 ego->name = GNUNET_malloc (name_size);
3621 GNUNET_memcpy (ego->name, name, name_size);
3622 3627
3623 GNUNET_CONTAINER_multihashmap_put (egos, &ego_pub_hash, ego, 3628 GNUNET_CONTAINER_multihashmap_put (egos, &ego_pub_hash, ego,
3624 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE); 3629 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE);
3625 }
3626 3630
3627 // FIXME: notify clients about changed ego 3631 // FIXME: notify clients about changed ego
3628} 3632}