gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: speed up ego creation/delet


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: speed up ego creation/deletion
Date: Sat, 25 May 2019 02:20:22 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 667d2b263 speed up ego creation/deletion
667d2b263 is described below

commit 667d2b263f77a12127efbd0824eeb87b3b10fb61
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat May 25 02:19:26 2019 +0200

    speed up ego creation/deletion
---
 src/identity/gnunet-identity.c |   7 +-
 src/identity/identity_api.c    | 337 +++++++++++++++--------------------------
 2 files changed, 126 insertions(+), 218 deletions(-)

diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c
index 635c59efd..e22ac9106 100644
--- a/src/identity/gnunet-identity.c
+++ b/src/identity/gnunet-identity.c
@@ -327,7 +327,12 @@ run (void *cls,
     fprintf (stderr, "Option -s requires option -e to be specified as 
well.\n");
     return;
   }
-  sh = GNUNET_IDENTITY_connect (cfg, &print_ego, NULL);
+  sh = GNUNET_IDENTITY_connect (cfg,
+                                (monitor | list) || (NULL != set_ego) ||
+                                    (NULL != set_subsystem)
+                                  ? &print_ego
+                                  : NULL,
+                                NULL);
   if (NULL != delete_ego)
     delete_op =
       GNUNET_IDENTITY_delete (sh, delete_ego, &delete_finished, &delete_op);
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index f16500ab5..6cf1b65ca 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -11,7 +11,7 @@
      WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      Affero General Public License for more details.
-    
+
      You should have received a copy of the GNU Affero General Public License
      along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -30,7 +30,7 @@
 #include "gnunet_identity_service.h"
 #include "identity.h"
 
-#define LOG(kind,...) GNUNET_log_from (kind, "identity-api",__VA_ARGS__)
+#define LOG(kind, ...) GNUNET_log_from (kind, "identity-api", __VA_ARGS__)
 
 /**
  * Handle for an ego.
@@ -102,7 +102,7 @@ struct GNUNET_IDENTITY_Operation
    * Private key to return to @e create_cont, or NULL.
    */
   struct GNUNET_CRYPTO_EcdsaPrivateKey *pk;
-  
+
   /**
    * Continuation to invoke with the result of the transmission for
    * 'get' operations (@e cont and @a create_cont will be NULL in this case).
@@ -113,7 +113,6 @@ struct GNUNET_IDENTITY_Operation
    * Closure for @e cont or @e cb.
    */
   void *cls;
-
 };
 
 
@@ -172,7 +171,6 @@ struct GNUNET_IDENTITY_Handle
    * Are we polling for incoming messages right now?
    */
   int in_receive;
-
 };
 
 
@@ -189,12 +187,10 @@ GNUNET_IDENTITY_ego_get_anonymous ()
 
   if (NULL != anon.pk)
     return &anon;
-  anon.pk = (struct GNUNET_CRYPTO_EcdsaPrivateKey *) 
GNUNET_CRYPTO_ecdsa_key_get_anonymous ();
-  GNUNET_CRYPTO_ecdsa_key_get_public (anon.pk,
-                                      &pub);
-  GNUNET_CRYPTO_hash (&pub,
-                      sizeof (pub),
-                      &anon.id);
+  anon.pk = (struct GNUNET_CRYPTO_EcdsaPrivateKey *)
+    GNUNET_CRYPTO_ecdsa_key_get_anonymous ();
+  GNUNET_CRYPTO_ecdsa_key_get_public (anon.pk, &pub);
+  GNUNET_CRYPTO_hash (&pub, sizeof (pub), &anon.id);
   return &anon;
 }
 
@@ -217,24 +213,17 @@ reconnect (void *cls);
  * @return #GNUNET_OK (continue to iterate)
  */
 static int
-free_ego (void *cls,
-         const struct GNUNET_HashCode *key,
-         void *value)
+free_ego (void *cls, const struct GNUNET_HashCode *key, void *value)
 {
   struct GNUNET_IDENTITY_Handle *h = cls;
   struct GNUNET_IDENTITY_Ego *ego = value;
 
   if (NULL != h->cb)
-    h->cb (h->cb_cls,
-          ego,
-          &ego->ctx,
-          NULL);
+    h->cb (h->cb_cls, ego, &ego->ctx, NULL);
   GNUNET_free (ego->pk);
   GNUNET_free (ego->name);
   GNUNET_assert (GNUNET_YES ==
-                 GNUNET_CONTAINER_multihashmap_remove (h->egos,
-                                                       key,
-                                                       value));
+                 GNUNET_CONTAINER_multihashmap_remove (h->egos, key, value));
   GNUNET_free (ego);
   return GNUNET_OK;
 }
@@ -259,35 +248,24 @@ reschedule_connect (struct GNUNET_IDENTITY_Handle *h)
   }
   while (NULL != (op = h->op_head))
   {
-    GNUNET_CONTAINER_DLL_remove (h->op_head,
-                                 h->op_tail,
-                                 op);
+    GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
     if (NULL != op->cont)
-      op->cont (op->cls,
-                "Error in communication with the identity service");
+      op->cont (op->cls, "Error in communication with the identity service");
     else if (NULL != op->cb)
-      op->cb (op->cls,
-              NULL,
-              NULL,
-              NULL);
+      op->cb (op->cls, NULL, NULL, NULL);
     else if (NULL != op->create_cont)
       op->create_cont (op->cls,
-                      NULL,
-                      "Failed to communicate with the identity service");
+                       NULL,
+                       "Failed to communicate with the identity service");
     GNUNET_free_non_null (op->pk);
     GNUNET_free (op);
   }
-  GNUNET_CONTAINER_multihashmap_iterate (h->egos,
-                                         &free_ego,
-                                         h);
+  GNUNET_CONTAINER_multihashmap_iterate (h->egos, &free_ego, h);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Scheduling task to reconnect to identity service in %s.\n",
-       GNUNET_STRINGS_relative_time_to_string (h->reconnect_delay,
-                                               GNUNET_YES));
+       GNUNET_STRINGS_relative_time_to_string (h->reconnect_delay, 
GNUNET_YES));
   h->reconnect_task =
-      GNUNET_SCHEDULER_add_delayed (h->reconnect_delay,
-                                    &reconnect,
-                                    h);
+    GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h);
   h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay);
 }
 
@@ -301,8 +279,7 @@ reschedule_connect (struct GNUNET_IDENTITY_Handle *h)
  * @param error error code
  */
 static void
-mq_error_handler (void *cls,
-                  enum GNUNET_MQ_Error error)
+mq_error_handler (void *cls, enum GNUNET_MQ_Error error)
 {
   struct GNUNET_IDENTITY_Handle *h = cls;
 
@@ -319,8 +296,7 @@ mq_error_handler (void *cls,
  * @return #GNUNET_OK if the message is well-formed
  */
 static int
-check_identity_result_code (void *cls,
-                            const struct ResultCodeMessage *rcm)
+check_identity_result_code (void *cls, const struct ResultCodeMessage *rcm)
 {
   uint16_t size = ntohs (rcm->header.size) - sizeof (*rcm);
   const char *str = (const char *) &rcm[1];
@@ -343,8 +319,7 @@ check_identity_result_code (void *cls,
  * @param rcm result message received
  */
 static void
-handle_identity_result_code (void *cls,
-                             const struct ResultCodeMessage *rcm)
+handle_identity_result_code (void *cls, const struct ResultCodeMessage *rcm)
 {
   struct GNUNET_IDENTITY_Handle *h = cls;
   struct GNUNET_IDENTITY_Operation *op;
@@ -358,18 +333,13 @@ handle_identity_result_code (void *cls,
     reschedule_connect (h);
     return;
   }
-  GNUNET_CONTAINER_DLL_remove (h->op_head,
-                               h->op_tail,
-                               op);
+  GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
   if (NULL != op->cont)
-    op->cont (op->cls,
-              str);
+    op->cont (op->cls, str);
   else if (NULL != op->cb)
     op->cb (op->cls, NULL, NULL, NULL);
   else if (NULL != op->create_cont)
-    op->create_cont (op->cls,
-                    (NULL == str) ? op->pk : NULL,
-                    str);
+    op->create_cont (op->cls, (NULL == str) ? op->pk : NULL, str);
   GNUNET_free_non_null (op->pk);
   GNUNET_free (op);
 }
@@ -383,16 +353,14 @@ handle_identity_result_code (void *cls,
  * @return #GNUNET_OK if the message is well-formed
  */
 static int
-check_identity_update (void *cls,
-                        const struct UpdateMessage *um)
+check_identity_update (void *cls, const struct UpdateMessage *um)
 {
   uint16_t size = ntohs (um->header.size);
   uint16_t name_len = ntohs (um->name_len);
   const char *str = (const char *) &um[1];
 
-  if ( (size != name_len + sizeof (struct UpdateMessage)) ||
-       ( (0 != name_len) &&
-         ('\0' != str[name_len - 1])) )
+  if ((size != name_len + sizeof (struct UpdateMessage)) ||
+      ((0 != name_len) && ('\0' != str[name_len - 1])))
   {
     GNUNET_break (0);
     return GNUNET_SYSERR;
@@ -408,8 +376,7 @@ check_identity_update (void *cls,
  * @param um message received
  */
 static void
-handle_identity_update (void *cls,
-                        const struct UpdateMessage *um)
+handle_identity_update (void *cls, const struct UpdateMessage *um)
 {
   struct GNUNET_IDENTITY_Handle *h = cls;
   uint16_t name_len = ntohs (um->name_len);
@@ -422,19 +389,12 @@ handle_identity_update (void *cls,
   {
     /* end of initial list of data */
     if (NULL != h->cb)
-      h->cb (h->cb_cls,
-             NULL,
-             NULL,
-             NULL);
+      h->cb (h->cb_cls, NULL, NULL, NULL);
     return;
   }
-  GNUNET_CRYPTO_ecdsa_key_get_public (&um->private_key,
-                                     &pub);
-  GNUNET_CRYPTO_hash (&pub,
-                      sizeof (pub),
-                      &id);
-  ego = GNUNET_CONTAINER_multihashmap_get (h->egos,
-                                           &id);
+  GNUNET_CRYPTO_ecdsa_key_get_public (&um->private_key, &pub);
+  GNUNET_CRYPTO_hash (&pub, sizeof (pub), &id);
+  ego = GNUNET_CONTAINER_multihashmap_get (h->egos, &id);
   if (NULL == ego)
   {
     /* ego was created */
@@ -451,18 +411,18 @@ handle_identity_update (void *cls,
     ego->name = GNUNET_strdup (str);
     ego->id = id;
     GNUNET_assert (GNUNET_YES ==
-                   GNUNET_CONTAINER_multihashmap_put (h->egos,
-                                                      &ego->id,
-                                                      ego,
-                                                      
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+                   GNUNET_CONTAINER_multihashmap_put (
+                     h->egos,
+                     &ego->id,
+                     ego,
+                     GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
   }
   if (NULL == str)
   {
     /* ego was deleted */
-    GNUNET_assert (GNUNET_YES ==
-                   GNUNET_CONTAINER_multihashmap_remove (h->egos,
-                                                         &ego->id,
-                                                         ego));
+    GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (h->egos,
+                                                                       
&ego->id,
+                                                                       ego));
   }
   else
   {
@@ -472,10 +432,7 @@ handle_identity_update (void *cls,
   }
   /* inform application about change */
   if (NULL != h->cb)
-    h->cb (h->cb_cls,
-           ego,
-           &ego->ctx,
-           str);
+    h->cb (h->cb_cls, ego, &ego->ctx, str);
   /* complete deletion */
   if (NULL == str)
   {
@@ -495,16 +452,13 @@ handle_identity_update (void *cls,
  * @return #GNUNET_OK if the message is well-formed
  */
 static int
-check_identity_set_default (void *cls,
-                            const struct SetDefaultMessage *sdm)
+check_identity_set_default (void *cls, const struct SetDefaultMessage *sdm)
 {
   uint16_t size = ntohs (sdm->header.size) - sizeof (*sdm);
   uint16_t name_len = ntohs (sdm->name_len);
   const char *str = (const char *) &sdm[1];
 
-  if ( (size != name_len) ||
-       ( (0 != name_len) &&
-         ('\0' != str[name_len - 1]) ) )
+  if ((size != name_len) || ((0 != name_len) && ('\0' != str[name_len - 1])))
   {
     GNUNET_break (0);
     return GNUNET_SYSERR;
@@ -522,8 +476,7 @@ check_identity_set_default (void *cls,
  * @param sdm message received
  */
 static void
-handle_identity_set_default (void *cls,
-                             const struct SetDefaultMessage *sdm)
+handle_identity_set_default (void *cls, const struct SetDefaultMessage *sdm)
 {
   struct GNUNET_IDENTITY_Handle *h = cls;
   struct GNUNET_IDENTITY_Operation *op;
@@ -531,13 +484,9 @@ handle_identity_set_default (void *cls,
   struct GNUNET_HashCode id;
   struct GNUNET_IDENTITY_Ego *ego;
 
-  GNUNET_CRYPTO_ecdsa_key_get_public (&sdm->private_key,
-                                     &pub);
-  GNUNET_CRYPTO_hash (&pub,
-                      sizeof (pub),
-                      &id);
-  ego = GNUNET_CONTAINER_multihashmap_get (h->egos,
-                                           &id);
+  GNUNET_CRYPTO_ecdsa_key_get_public (&sdm->private_key, &pub);
+  GNUNET_CRYPTO_hash (&pub, sizeof (pub), &id);
+  ego = GNUNET_CONTAINER_multihashmap_get (h->egos, &id);
   if (NULL == ego)
   {
     GNUNET_break (0);
@@ -553,14 +502,9 @@ handle_identity_set_default (void *cls,
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Received SET_DEFAULT message from identity service\n");
-  GNUNET_CONTAINER_DLL_remove (h->op_head,
-                               h->op_tail,
-                               op);
+  GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
   if (NULL != op->cb)
-    op->cb (op->cls,
-            ego,
-            &ego->ctx,
-            ego->name);
+    op->cb (op->cls, ego, &ego->ctx, ego->name);
   GNUNET_free (op);
 }
 
@@ -574,39 +518,35 @@ static void
 reconnect (void *cls)
 {
   struct GNUNET_IDENTITY_Handle *h = cls;
-  struct GNUNET_MQ_MessageHandler handlers[] = {
-    GNUNET_MQ_hd_var_size (identity_result_code,
-                           GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE,
-                           struct ResultCodeMessage,
-                           h),
-    GNUNET_MQ_hd_var_size (identity_update,
-                           GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE,
-                           struct UpdateMessage,
-                           h),
-    GNUNET_MQ_hd_var_size (identity_set_default,
-                           GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT,
-                           struct SetDefaultMessage,
-                           h),
-    GNUNET_MQ_handler_end ()
-  };
+  struct GNUNET_MQ_MessageHandler handlers[] =
+    {GNUNET_MQ_hd_var_size (identity_result_code,
+                            GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE,
+                            struct ResultCodeMessage,
+                            h),
+     GNUNET_MQ_hd_var_size (identity_update,
+                            GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE,
+                            struct UpdateMessage,
+                            h),
+     GNUNET_MQ_hd_var_size (identity_set_default,
+                            GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT,
+                            struct SetDefaultMessage,
+                            h),
+     GNUNET_MQ_handler_end ()};
   struct GNUNET_MQ_Envelope *env;
   struct GNUNET_MessageHeader *msg;
 
   h->reconnect_task = NULL;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Connecting to identity service.\n");
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to identity service.\n");
   GNUNET_assert (NULL == h->mq);
-  h->mq = GNUNET_CLIENT_connect (h->cfg,
-                                 "identity",
-                                 handlers,
-                                 &mq_error_handler,
-                                 h);
+  h->mq =
+    GNUNET_CLIENT_connect (h->cfg, "identity", handlers, &mq_error_handler, h);
   if (NULL == h->mq)
     return;
-  env = GNUNET_MQ_msg (msg,
-                       GNUNET_MESSAGE_TYPE_IDENTITY_START);
-  GNUNET_MQ_send (h->mq,
-                  env);
+  if (NULL != h->cb)
+  {
+    env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_IDENTITY_START);
+    GNUNET_MQ_send (h->mq, env);
+  }
 }
 
 
@@ -620,8 +560,8 @@ reconnect (void *cls)
  */
 struct GNUNET_IDENTITY_Handle *
 GNUNET_IDENTITY_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                        GNUNET_IDENTITY_Callback cb,
-                        void *cb_cls)
+                         GNUNET_IDENTITY_Callback cb,
+                         void *cb_cls)
 {
   struct GNUNET_IDENTITY_Handle *h;
 
@@ -661,10 +601,9 @@ GNUNET_IDENTITY_ego_get_private_key (const struct 
GNUNET_IDENTITY_Ego *ego)
  */
 void
 GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego,
-                                   struct GNUNET_CRYPTO_EcdsaPublicKey *pk)
+                                    struct GNUNET_CRYPTO_EcdsaPublicKey *pk)
 {
-  GNUNET_CRYPTO_ecdsa_key_get_public (ego->pk,
-                                      pk);
+  GNUNET_CRYPTO_ecdsa_key_get_public (ego->pk, pk);
 }
 
 
@@ -680,9 +619,9 @@ GNUNET_IDENTITY_ego_get_public_key (const struct 
GNUNET_IDENTITY_Ego *ego,
  */
 struct GNUNET_IDENTITY_Operation *
 GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *h,
-                    const char *service_name,
-                    GNUNET_IDENTITY_Callback cb,
-                    void *cb_cls)
+                     const char *service_name,
+                     GNUNET_IDENTITY_Callback cb,
+                     void *cb_cls)
 {
   struct GNUNET_IDENTITY_Operation *op;
   struct GNUNET_MQ_Envelope *env;
@@ -701,19 +640,13 @@ GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *h,
   op->h = h;
   op->cb = cb;
   op->cls = cb_cls;
-  GNUNET_CONTAINER_DLL_insert_tail (h->op_head,
-                                   h->op_tail,
-                                   op);
-  env = GNUNET_MQ_msg_extra (gdm,
-                             slen,
-                             GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT);
+  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
+  env =
+    GNUNET_MQ_msg_extra (gdm, slen, GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT);
   gdm->name_len = htons (slen);
   gdm->reserved = htons (0);
-  GNUNET_memcpy (&gdm[1],
-          service_name,
-          slen);
-  GNUNET_MQ_send (h->mq,
-                  env);
+  GNUNET_memcpy (&gdm[1], service_name, slen);
+  GNUNET_MQ_send (h->mq, env);
   return op;
 }
 
@@ -730,10 +663,10 @@ GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *h,
  */
 struct GNUNET_IDENTITY_Operation *
 GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *h,
-                    const char *service_name,
-                    struct GNUNET_IDENTITY_Ego *ego,
-                    GNUNET_IDENTITY_Continuation cont,
-                    void *cont_cls)
+                     const char *service_name,
+                     struct GNUNET_IDENTITY_Ego *ego,
+                     GNUNET_IDENTITY_Continuation cont,
+                     void *cont_cls)
 {
   struct GNUNET_IDENTITY_Operation *op;
   struct GNUNET_MQ_Envelope *env;
@@ -752,20 +685,14 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *h,
   op->h = h;
   op->cont = cont;
   op->cls = cont_cls;
-  GNUNET_CONTAINER_DLL_insert_tail (h->op_head,
-                                   h->op_tail,
-                                   op);
-  env = GNUNET_MQ_msg_extra (sdm,
-                             slen,
-                             GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT);
+  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
+  env =
+    GNUNET_MQ_msg_extra (sdm, slen, GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT);
   sdm->name_len = htons (slen);
   sdm->reserved = htons (0);
   sdm->private_key = *ego->pk;
-  GNUNET_memcpy (&sdm[1],
-          service_name,
-          slen);
-  GNUNET_MQ_send (h->mq,
-                  env);
+  GNUNET_memcpy (&sdm[1], service_name, slen);
+  GNUNET_MQ_send (h->mq, env);
   return op;
 }
 
@@ -781,9 +708,9 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *h,
  */
 struct GNUNET_IDENTITY_Operation *
 GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
-                       const char *name,
-                       GNUNET_IDENTITY_CreateContinuation cont,
-                       void *cont_cls)
+                        const char *name,
+                        GNUNET_IDENTITY_CreateContinuation cont,
+                        void *cont_cls)
 {
   struct GNUNET_IDENTITY_Operation *op;
   struct GNUNET_MQ_Envelope *env;
@@ -803,22 +730,15 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
   op->h = h;
   op->create_cont = cont;
   op->cls = cont_cls;
-  GNUNET_CONTAINER_DLL_insert_tail (h->op_head,
-                                   h->op_tail,
-                                   op);
-  env = GNUNET_MQ_msg_extra (crm,
-                             slen,
-                             GNUNET_MESSAGE_TYPE_IDENTITY_CREATE);
+  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
+  env = GNUNET_MQ_msg_extra (crm, slen, GNUNET_MESSAGE_TYPE_IDENTITY_CREATE);
   crm->name_len = htons (slen);
   crm->reserved = htons (0);
   pk = GNUNET_CRYPTO_ecdsa_key_create ();
   crm->private_key = *pk;
   op->pk = pk;
-  GNUNET_memcpy (&crm[1],
-          name,
-          slen);
-  GNUNET_MQ_send (h->mq,
-                  env);
+  GNUNET_memcpy (&crm[1], name, slen);
+  GNUNET_MQ_send (h->mq, env);
   return op;
 }
 
@@ -835,10 +755,10 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
  */
 struct GNUNET_IDENTITY_Operation *
 GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *h,
-                       const char *old_name,
-                       const char *new_name,
-                       GNUNET_IDENTITY_Continuation cb,
-                       void *cb_cls)
+                        const char *old_name,
+                        const char *new_name,
+                        GNUNET_IDENTITY_Continuation cb,
+                        void *cb_cls)
 {
   struct GNUNET_IDENTITY_Operation *op;
   struct GNUNET_MQ_Envelope *env;
@@ -851,9 +771,10 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *h,
     return NULL;
   slen_old = strlen (old_name) + 1;
   slen_new = strlen (new_name) + 1;
-  if ( (slen_old >= GNUNET_MAX_MESSAGE_SIZE) ||
-       (slen_new >= GNUNET_MAX_MESSAGE_SIZE) ||
-       (slen_old + slen_new >= GNUNET_MAX_MESSAGE_SIZE - sizeof (struct 
RenameMessage)) )
+  if ((slen_old >= GNUNET_MAX_MESSAGE_SIZE) ||
+      (slen_new >= GNUNET_MAX_MESSAGE_SIZE) ||
+      (slen_old + slen_new >=
+       GNUNET_MAX_MESSAGE_SIZE - sizeof (struct RenameMessage)))
   {
     GNUNET_break (0);
     return NULL;
@@ -862,23 +783,16 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *h,
   op->h = h;
   op->cont = cb;
   op->cls = cb_cls;
-  GNUNET_CONTAINER_DLL_insert_tail (h->op_head,
-                                   h->op_tail,
-                                   op);
+  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
   env = GNUNET_MQ_msg_extra (grm,
                              slen_old + slen_new,
                              GNUNET_MESSAGE_TYPE_IDENTITY_RENAME);
   grm->old_name_len = htons (slen_old);
   grm->new_name_len = htons (slen_new);
   dst = (char *) &grm[1];
-  GNUNET_memcpy (dst,
-          old_name,
-          slen_old);
-  GNUNET_memcpy (&dst[slen_old],
-          new_name,
-          slen_new);
-  GNUNET_MQ_send (h->mq,
-                  env);
+  GNUNET_memcpy (dst, old_name, slen_old);
+  GNUNET_memcpy (&dst[slen_old], new_name, slen_new);
+  GNUNET_MQ_send (h->mq, env);
   return op;
 }
 
@@ -894,9 +808,9 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *h,
  */
 struct GNUNET_IDENTITY_Operation *
 GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *h,
-                       const char *name,
-                       GNUNET_IDENTITY_Continuation cb,
-                       void *cb_cls)
+                        const char *name,
+                        GNUNET_IDENTITY_Continuation cb,
+                        void *cb_cls)
 {
   struct GNUNET_IDENTITY_Operation *op;
   struct GNUNET_MQ_Envelope *env;
@@ -915,19 +829,12 @@ GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *h,
   op->h = h;
   op->cont = cb;
   op->cls = cb_cls;
-  GNUNET_CONTAINER_DLL_insert_tail (h->op_head,
-                                   h->op_tail,
-                                   op);
-  env = GNUNET_MQ_msg_extra (gdm,
-                             slen,
-                             GNUNET_MESSAGE_TYPE_IDENTITY_DELETE);
+  GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
+  env = GNUNET_MQ_msg_extra (gdm, slen, GNUNET_MESSAGE_TYPE_IDENTITY_DELETE);
   gdm->name_len = htons (slen);
   gdm->reserved = htons (0);
-  GNUNET_memcpy (&gdm[1],
-          name,
-          slen);
-  GNUNET_MQ_send (h->mq,
-                  env);
+  GNUNET_memcpy (&gdm[1], name, slen);
+  GNUNET_MQ_send (h->mq, env);
   return op;
 }
 
@@ -972,18 +879,14 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle 
*h)
   }
   if (NULL != h->egos)
   {
-    GNUNET_CONTAINER_multihashmap_iterate (h->egos,
-                                          &free_ego,
-                                          h);
+    GNUNET_CONTAINER_multihashmap_iterate (h->egos, &free_ego, h);
     GNUNET_CONTAINER_multihashmap_destroy (h->egos);
     h->egos = NULL;
   }
   while (NULL != (op = h->op_head))
   {
     GNUNET_break (NULL == op->cont);
-    GNUNET_CONTAINER_DLL_remove (h->op_head,
-                                h->op_tail,
-                                op);
+    GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
     GNUNET_free_non_null (op->pk);
     GNUNET_free (op);
   }

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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