summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjospaeth <spaethj@in.tum.de>2020-09-04 20:02:39 +0200
committerjospaeth <spaethj@in.tum.de>2020-09-04 20:02:39 +0200
commit5e5c582c8338b9e231ea9c2f70d5bc83bd531496 (patch)
tree7bf4827f56de39e68412f16ce8d0d5de2a582707
parentc6fd8f93675ef986184c9a93183e3d7767a4b8ed (diff)
don't maintain a plugin's ego list when cleaning up
-rw-r--r--src/escrow/escrow.h5
-rw-r--r--src/escrow/escrow_plugin_helper.c10
-rw-r--r--src/escrow/plugin_escrow_anastasis.c2
-rw-r--r--src/escrow/plugin_escrow_gns.c2
-rw-r--r--src/escrow/plugin_escrow_plaintext.c2
5 files changed, 18 insertions, 3 deletions
diff --git a/src/escrow/escrow.h b/src/escrow/escrow.h
index 1f5257970..a9e6e99e1 100644
--- a/src/escrow/escrow.h
+++ b/src/escrow/escrow.h
@@ -41,6 +41,11 @@
*/
#define ESCROW_PLUGIN_STATE_POST_INIT 1
+/**
+ * State while cleaning up
+ */
+#define ESCROW_PLUGIN_STATE_CLEANUP 2
+
/**
* The ego list
diff --git a/src/escrow/escrow_plugin_helper.c b/src/escrow/escrow_plugin_helper.c
index f5f67d4bf..25648dfa1 100644
--- a/src/escrow/escrow_plugin_helper.c
+++ b/src/escrow/escrow_plugin_helper.c
@@ -75,7 +75,10 @@ ESCROW_list_ego (void *cls,
struct EgoEntry *ego_entry;
struct GNUNET_CRYPTO_EcdsaPublicKey pk;
- // TODO: error when this method is called at cleanup if init is not yet finished
+ /* don't add/change/delete egos when we are already cleaning up */
+ if (ESCROW_PLUGIN_STATE_CLEANUP == ph->state)
+ return;
+
if ((NULL == ego) && (ESCROW_PLUGIN_STATE_INIT == ph->state))
{
ph->state = ESCROW_PLUGIN_STATE_POST_INIT;
@@ -109,8 +112,9 @@ ESCROW_list_ego (void *cls,
GNUNET_free (ego_entry->identifier);
ego_entry->identifier = GNUNET_strdup (identifier);
/* TODO: this handles an edge case when the user restores an ego
- that already exists. In that case, @param ego is the same for the
- new as for the existing ego and this method thinks it is a rename. */
+ that already exists, i.e. with the same private key. In that case,
+ @param ego is the same for the new as for the existing ego and this
+ method thinks it is a rename. */
if (NULL != ph->ego_create_cont)
ph->ego_create_cont (ego);
break;
diff --git a/src/escrow/plugin_escrow_anastasis.c b/src/escrow/plugin_escrow_anastasis.c
index 5353b435a..8a5c05e24 100644
--- a/src/escrow/plugin_escrow_anastasis.c
+++ b/src/escrow/plugin_escrow_anastasis.c
@@ -218,6 +218,8 @@ libgnunet_plugin_escrow_anastasis_done (void *cls)
{
struct GNUNET_ESCROW_KeyPluginFunctions *api = cls;
+ ph.state = ESCROW_PLUGIN_STATE_CLEANUP;
+
GNUNET_free (api);
GNUNET_IDENTITY_disconnect (identity_handle);
ESCROW_cleanup_ego_list (&ph);
diff --git a/src/escrow/plugin_escrow_gns.c b/src/escrow/plugin_escrow_gns.c
index 422a3849e..2d419caaf 100644
--- a/src/escrow/plugin_escrow_gns.c
+++ b/src/escrow/plugin_escrow_gns.c
@@ -1729,6 +1729,8 @@ libgnunet_plugin_escrow_gns_done (void *cls)
{
struct GNUNET_ESCROW_KeyPluginFunctions *api = cls;
+ ph.state = ESCROW_PLUGIN_STATE_CLEANUP;
+
GNUNET_free (api);
GNUNET_IDENTITY_disconnect (identity_handle);
ESCROW_cleanup_ego_list (&ph);
diff --git a/src/escrow/plugin_escrow_plaintext.c b/src/escrow/plugin_escrow_plaintext.c
index 8e2c2204b..36c275a6b 100644
--- a/src/escrow/plugin_escrow_plaintext.c
+++ b/src/escrow/plugin_escrow_plaintext.c
@@ -540,6 +540,8 @@ libgnunet_plugin_escrow_plaintext_done (void *cls)
{
struct GNUNET_ESCROW_KeyPluginFunctions *api = cls;
+ ph.state = ESCROW_PLUGIN_STATE_CLEANUP;
+
GNUNET_free (api);
GNUNET_IDENTITY_disconnect (identity_handle);
ESCROW_cleanup_ego_list (&ph);