gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r25216 - gnunet-gtk/src/setup


From: gnunet
Subject: [GNUnet-SVN] r25216 - gnunet-gtk/src/setup
Date: Tue, 4 Dec 2012 10:57:02 +0100

Author: grothoff
Date: 2012-12-04 10:57:02 +0100 (Tue, 04 Dec 2012)
New Revision: 25216

Modified:
   gnunet-gtk/src/setup/gnunet-setup-gns-edit.h
   gnunet-gtk/src/setup/gnunet-setup-gns.c
Log:
-finishing implementation of record moving logic

Modified: gnunet-gtk/src/setup/gnunet-setup-gns-edit.h
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-gns-edit.h        2012-12-04 09:51:51 UTC 
(rev 25215)
+++ gnunet-gtk/src/setup/gnunet-setup-gns-edit.h        2012-12-04 09:57:02 UTC 
(rev 25216)
@@ -64,6 +64,16 @@
 {
 
   /**
+   * If a record move operation is desired, we keep these in a DLL.
+   */
+  struct EditDialogContext *next;
+
+  /**
+   * If a record move operation is desired, we keep these in a DLL.
+   */
+  struct EditDialogContext *prev;
+
+  /**
    * Where in the tree view are we editing?
    */
   GtkTreeIter it;

Modified: gnunet-gtk/src/setup/gnunet-setup-gns.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-gns.c     2012-12-04 09:51:51 UTC (rev 
25215)
+++ gnunet-gtk/src/setup/gnunet-setup-gns.c     2012-12-04 09:57:02 UTC (rev 
25216)
@@ -346,6 +346,16 @@
 static struct PseuContext *pc_tail;
 
 /**
+ * Tail of linked list of active record move operations.
+ */
+static struct EditDialogContext *edc_head;
+
+/**
+ * Tail of linked list of active record move operations.
+ */
+static struct EditDialogContext *edc_tail;
+
+/**
  * Name of our zone as a string.
  */
 static char *zone_as_string;
@@ -664,6 +674,8 @@
 
   if (NULL != uc->qe)
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+               _("Setup shutdown before all records could be written. Record 
lost!\n"));
     GNUNET_NAMESTORE_cancel (uc->qe);
     uc->qe = NULL;
   }
@@ -972,6 +984,8 @@
 {
   if (NULL != rc->qe)
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+               _("Setup shutdown before all records could be written. Record 
lost!\n"));
     GNUNET_NAMESTORE_cancel (rc->qe);
     rc->qe = NULL;
   }
@@ -1159,6 +1173,9 @@
   struct EditDialogContext *edc = cls;
   
   edc->qe = NULL;
+  GNUNET_CONTAINER_DLL_remove (edc_head,
+                              edc_tail,
+                              edc);
   if (NULL != emsg)
     show_error_message (_("Failed to move record to target zone"),
                        emsg);
@@ -1190,6 +1207,9 @@
   {
     show_error_message (_("Failed to access key for target zone"),
                        emsg);
+    GNUNET_CONTAINER_DLL_remove (edc_head,
+                                edc_tail,
+                                edc);
     free_edit_dialog_context (edc);
     return;
   }
@@ -1201,6 +1221,10 @@
   {
     /* edit dialog produced invalid value string!? */
     GNUNET_break (0);
+    GNUNET_CONTAINER_DLL_remove (edc_head,
+                                edc_tail,
+                                edc);    
+    free_edit_dialog_context (edc);
     return;
   }
   rd.record_type = edc->record_type;
@@ -1334,6 +1358,15 @@
       edc->rkgc = GNUNET_CRYPTO_rsa_key_create_start (keyfile,
                                                      &record_move_continuation,
                                                      edc);
+      if (NULL == edc->rkgc)
+      {
+       GNUNET_break (0);
+       GNUNET_free (keyfile);
+       break;
+      }
+      GNUNET_CONTAINER_DLL_insert (edc_head,
+                                  edc_tail,
+                                  edc);    
       GNUNET_free (keyfile);
       return;
     }
@@ -2293,6 +2326,8 @@
 void
 GNUNET_SETUP_gns_done ()
 {
+  struct EditDialogContext *edc;
+
   gtk_widget_show (GTK_WIDGET (GNUNET_SETUP_get_object 
("GNUNET_setup_gns_status_label")));
   gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object 
("GNUNET_setup_gns_main_scrolledwindow")));
   gtk_tree_store_clear (ts);
@@ -2302,6 +2337,17 @@
     free_update_context (uc_head);
   while (NULL != rc_head)
     free_remove_context (rc_head);
+  while (NULL != (edc = edc_head))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+               _("Setup shutdown before all records could be written. Record 
lost!\n"));
+    if (NULL != edc->qe)
+      GNUNET_NAMESTORE_cancel (edc->qe);
+    if (NULL != edc->rkgc)
+      GNUNET_CRYPTO_rsa_key_create_stop (edc->rkgc);
+    GNUNET_CONTAINER_DLL_remove (edc_head, edc_tail, edc);
+    free_edit_dialog_context (edc);
+  }
   if (NULL != namestore)
   {
     GNUNET_NAMESTORE_disconnect (namestore);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]