aboutsummaryrefslogtreecommitdiff
path: root/src/escrow/gnunet-escrow.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/escrow/gnunet-escrow.c')
-rw-r--r--src/escrow/gnunet-escrow.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/escrow/gnunet-escrow.c b/src/escrow/gnunet-escrow.c
index 1651d96ed..32b139259 100644
--- a/src/escrow/gnunet-escrow.c
+++ b/src/escrow/gnunet-escrow.c
@@ -117,7 +117,11 @@ static struct GNUNET_SCHEDULER_Task *cleanup_task;
117static void 117static void
118do_cleanup (void *cls) 118do_cleanup (void *cls)
119{ 119{
120 GNUNET_ESCROW_fini (escrow_handle); 120 cleanup_task = NULL;
121 if (NULL != escrow_handle)
122 GNUNET_ESCROW_fini (escrow_handle);
123 if (NULL != identity_handle)
124 GNUNET_IDENTITY_disconnect (identity_handle);
121 if (NULL != put_ego) 125 if (NULL != put_ego)
122 { 126 {
123 GNUNET_free (put_ego); 127 GNUNET_free (put_ego);
@@ -135,7 +139,7 @@ do_cleanup (void *cls)
135 } 139 }
136 if (NULL != ego) 140 if (NULL != ego)
137 { 141 {
138 GNUNET_free (ego); 142 //GNUNET_free (ego); // TODO: free correctly!
139 ego = NULL; 143 ego = NULL;
140 } 144 }
141 method = 0; 145 method = 0;
@@ -153,7 +157,8 @@ put_cb (void *cls,
153 method); 157 method);
154 158
155 fprintf (stdout, "Escrow finished! Please keep the following anchor \ 159 fprintf (stdout, "Escrow finished! Please keep the following anchor \
156 in order to restore the key later!\n%s\n", anchorString); 160in order to restore the key later!\n%s\n", anchorString);
161 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
157} 162}
158 163
159 164
@@ -175,6 +180,7 @@ verify_cb (void *cls,
175 default: 180 default:
176 fprintf (stderr, "invalid verificationResult!\n"); 181 fprintf (stderr, "invalid verificationResult!\n");
177 } 182 }
183 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
178} 184}
179 185
180 186
@@ -188,7 +194,8 @@ get_cb (void *cls,
188 fprintf (stderr, _ ("escrow failed!")); 194 fprintf (stderr, _ ("escrow failed!"));
189 return; 195 return;
190 } 196 }
191 fprintf (stdout, "Ego %s could successfully be restored!", ego->name); 197 fprintf (stdout, "Ego %s could successfully be restored!\n", ego->name);
198 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
192} 199}
193 200
194 201
@@ -342,10 +349,13 @@ run (void *cls,
342 349
343 escrow_handle = GNUNET_ESCROW_init (c); 350 escrow_handle = GNUNET_ESCROW_init (c);
344 351
345 /* parse anchor_string according to method */ 352 if (NULL != anchor_string)
346 anchor = GNUNET_ESCROW_anchor_string_to_data (escrow_handle, 353 {
347 anchor_string, 354 /* parse anchor_string according to method */
348 method); 355 anchor = GNUNET_ESCROW_anchor_string_to_data (escrow_handle,
356 anchor_string,
357 method);
358 }
349 359
350 /* connect to identity service in order to get the egos */ 360 /* connect to identity service in order to get the egos */
351 identity_handle = GNUNET_IDENTITY_connect (c, &ego_cb, ego_name); 361 identity_handle = GNUNET_IDENTITY_connect (c, &ego_cb, ego_name);