gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r38026 - gnunet/src/core


From: gnunet
Subject: [GNUnet-SVN] r38026 - gnunet/src/core
Date: Tue, 27 Sep 2016 01:18:34 +0200

Author: grothoff
Date: 2016-09-27 01:18:33 +0200 (Tue, 27 Sep 2016)
New Revision: 38026

Modified:
   gnunet/src/core/gnunet-service-core.c
Log:
init connect map on connect

Modified: gnunet/src/core/gnunet-service-core.c
===================================================================
--- gnunet/src/core/gnunet-service-core.c       2016-09-26 21:35:46 UTC (rev 
38025)
+++ gnunet/src/core/gnunet-service-core.c       2016-09-26 23:18:33 UTC (rev 
38026)
@@ -63,7 +63,7 @@
    * Message queue to talk to @e client.
    */
   struct GNUNET_MQ_Handle *mq;
-  
+
   /**
    * Array of the types of messages this peer cares
    * about (with @e tcnt entries).  Allocated as part
@@ -70,7 +70,7 @@
    * of this client struct, do not free!
    */
   uint16_t *types;
-  
+
   /**
    * Map of peer identities to active transmission requests of this
    * client to the peer (of type `struct GSC_ClientActiveRequest`).
@@ -156,7 +156,7 @@
  * Check #GNUNET_MESSAGE_TYPE_CORE_INIT request.
  *
  * @param cls client that sent #GNUNET_MESSAGE_TYPE_CORE_INIT
- * @param im the `struct InitMessage` 
+ * @param im the `struct InitMessage`
  * @return #GNUNET_OK if @a im is well-formed
  */
 static int
@@ -171,7 +171,7 @@
  * Handle #GNUNET_MESSAGE_TYPE_CORE_INIT request.
  *
  * @param cls client that sent #GNUNET_MESSAGE_TYPE_CORE_INIT
- * @param im the `struct InitMessage` 
+ * @param im the `struct InitMessage`
  */
 static void
 handle_client_init (void *cls,
@@ -190,8 +190,6 @@
   c->options = ntohl (im->options);
   all_client_options |= c->options;
   c->types = GNUNET_malloc (msize);
-  c->connectmap = GNUNET_CONTAINER_multipeermap_create (16,
-                                                       GNUNET_NO);
   GNUNET_assert (GNUNET_YES ==
                  GNUNET_CONTAINER_multipeermap_put (c->connectmap,
                                                     &GSC_my_identity,
@@ -606,10 +604,12 @@
                   struct GNUNET_MQ_Handle *mq)
 {
   struct GSC_Client *c;
-  
+
   c = GNUNET_new (struct GSC_Client);
   c->client = client;
   c->mq = mq;
+  c->connectmap = GNUNET_CONTAINER_multipeermap_create (16,
+                                                       GNUNET_NO);
   GNUNET_CONTAINER_DLL_insert (client_head,
                               client_tail,
                               c);
@@ -644,11 +644,8 @@
                                            NULL);
     GNUNET_CONTAINER_multipeermap_destroy (c->requests);
   }
-  if (NULL != c->connectmap)
-  {
-    GNUNET_CONTAINER_multipeermap_destroy (c->connectmap);
-    c->connectmap = NULL;
-  }
+  GNUNET_CONTAINER_multipeermap_destroy (c->connectmap);
+  c->connectmap = NULL;
   if (NULL != c->types)
   {
     GSC_TYPEMAP_remove (c->types,
@@ -844,7 +841,7 @@
                                                             sender)) );
     GNUNET_MQ_send (c->mq,
                    env);
-  }  
+  }
 }
 
 
@@ -890,7 +887,7 @@
                             const struct GNUNET_MessageHeader *message)
 {
   struct GSC_Client *c = cls;
-  
+
   GNUNET_SERVICE_client_continue (c->client);
   GSC_KX_handle_client_monitor_peers (c->mq);
 }
@@ -957,7 +954,7 @@
  NULL,
  GNUNET_MQ_hd_var_size (client_init,
                        GNUNET_MESSAGE_TYPE_CORE_INIT,
-                       struct InitMessage, 
+                       struct InitMessage,
                        NULL),
  GNUNET_MQ_hd_fixed_size (client_monitor_peers,
                          GNUNET_MESSAGE_TYPE_CORE_MONITOR_PEERS,




reply via email to

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