removing deprecated argument in 'init' callback of GNUNET_CORE_connect
authorChristian Grothoff <christian@grothoff.org>
Wed, 21 Aug 2013 16:03:30 +0000 (16:03 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 21 Aug 2013 16:03:30 +0000 (16:03 +0000)
19 files changed:
src/core/core_api.c
src/core/gnunet-core.c
src/core/test_core_api.c
src/core/test_core_api_reliability.c
src/core/test_core_api_send_to_self.c
src/core/test_core_api_start_only.c
src/core/test_core_quota_compliance.c
src/dht/gnunet-service-dht_neighbours.c
src/dv/gnunet-service-dv.c
src/experimentation/gnunet-daemon-experimentation_nodes.c
src/fs/gnunet-service-fs.c
src/hostlist/gnunet-daemon-hostlist.c
src/include/gnunet_core_service.h
src/integration-tests/connection_watchdog.c
src/mesh/gnunet-service-mesh-enc.c
src/mesh/gnunet-service-mesh.c
src/nse/gnunet-service-nse.c
src/testbed/gnunet-service-testbed_cache.c
src/topology/gnunet-daemon-topology.c

index ccd159d15e3653087bfa91d13a065b55577987b5..2198f7e2c44414b4f8c3c135f89f4844f35e7bcd 100644 (file)
@@ -782,7 +782,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
       h->init = NULL;
       LOG (GNUNET_ERROR_TYPE_DEBUG, "Connected to core service of peer `%s'.\n",
            GNUNET_i2s (&h->me));
-      init (h->cls, h, &h->me);
+      init (h->cls, &h->me);
     }
     else
     {
index 37f1caec2e97de87b01505a7a12493efb24fedea..9bfd18ec9cacd910ebd56a92e6fbb608b228bdc9 100644 (file)
@@ -72,7 +72,8 @@ shutdown_task (void *cls,
  * @param peer peer identity this notification is about
  */
 static void
-connected_peer_callback (void *cls, const struct GNUNET_PeerIdentity *peer)
+connected_peer_callback (void *cls, 
+                        const struct GNUNET_PeerIdentity *peer)
 {
   struct GNUNET_CRYPTO_HashAsciiEncoded enc;
 
@@ -82,11 +83,10 @@ connected_peer_callback (void *cls, const struct GNUNET_PeerIdentity *peer)
   printf (_("Peer `%s'\n"), (const char *) &enc);
 }
 
-void
+
+static void
 monitor_notify_startup (void *cls,
-                       struct GNUNET_CORE_Handle * server,
-                       const struct GNUNET_PeerIdentity *
-                       my_identity)
+                       const struct GNUNET_PeerIdentity *my_identity)
 {
   my_id = (*my_identity);
 }
@@ -146,7 +146,6 @@ monitor_notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
 }
 
 
-
 /**
  * Main function that will be run by the scheduler.
  *
index 184a640925649c450d4d5bae205b04173e8ffbc6..348bd89750a0d1a773dde8c2c18dc71200188700 100644 (file)
@@ -264,16 +264,14 @@ connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
 
 static void
-init_notify (void *cls, struct GNUNET_CORE_Handle *server,
+init_notify (void *cls, 
              const struct GNUNET_PeerIdentity *my_identity)
 {
   struct PeerContext *p = cls;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Core connection to `%4s' established\n",
               GNUNET_i2s (my_identity));
-  GNUNET_assert (server != NULL);
   p->id = *my_identity;
-  p->ch = server;
   if (cls == &p1)
   {
     GNUNET_assert (ok == 2);
index 29f39585e6239aa4a0da1641b9cacc6555055d80..e0db5eaedd94e074102caad2d0c8a064d4bdcf06 100644 (file)
@@ -358,7 +358,7 @@ static struct GNUNET_CORE_MessageHandler handlers[] = {
 
 
 static void
-init_notify (void *cls, struct GNUNET_CORE_Handle *server,
+init_notify (void *cls, 
              const struct GNUNET_PeerIdentity *my_identity)
 {
   struct PeerContext *p = cls;
@@ -366,9 +366,7 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Connection to CORE service of `%4s' established\n",
               GNUNET_i2s (my_identity));
-  GNUNET_assert (server != NULL);
   p->id = *my_identity;
-  p->ch = server;
   if (cls == &p1)
   {
     GNUNET_assert (ok == 2);
index 82048ea9258dc19bfc49b05caeaa5bc8a2b83359..4e2ee3fe46428f7e27299b7615cfefbba7162906 100644 (file)
@@ -103,12 +103,12 @@ send_message (void *cls, size_t size, void *buf)
 
 
 static void
-init (void *cls, struct GNUNET_CORE_Handle *core,
+init (void *cls, 
       const struct GNUNET_PeerIdentity *my_identity)
 {
-  if (core == NULL)
+  if (NULL == my_identity)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Could NOT connect to CORE;\n");
+    GNUNET_break (0);
     return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
index e98b374d2c149ba5d4da4b15856f47aab3b49ca3..ca16eb85669ea3934d54f7a177d9d2a5e3974096 100644 (file)
@@ -104,14 +104,12 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
 
 static void
-init_notify (void *cls, struct GNUNET_CORE_Handle *server,
+init_notify (void *cls, 
              const struct GNUNET_PeerIdentity *my_identity)
 {
   struct PeerContext *p = cls;
 
-  GNUNET_assert (server != NULL);
-  GNUNET_assert (p->ch == server);
-  if (cls == &p1)
+  if (p == &p1)
   {
     /* connect p2 */
     p2.ch =
@@ -121,7 +119,7 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server,
   }
   else
   {
-    GNUNET_assert (cls == &p2);
+    GNUNET_assert (p == &p2);
     GNUNET_SCHEDULER_cancel (timeout_task_id);
     GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
   }
index 9eb4d841f418922324d1b1bb61cdfccd9d986c67..0078a2dafeaeddea7d83c6ef4ab21eeb5cc92fd5 100644 (file)
@@ -500,7 +500,7 @@ static struct GNUNET_CORE_MessageHandler handlers[] = {
 
 
 static void
-init_notify (void *cls, struct GNUNET_CORE_Handle *server,
+init_notify (void *cls, 
              const struct GNUNET_PeerIdentity *my_identity)
 {
   struct PeerContext *p = cls;
@@ -508,9 +508,8 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Connection to CORE service of `%4s' established\n",
               GNUNET_i2s (my_identity));
-  GNUNET_assert (server != NULL);
+  GNUNET_assert (NULL != my_identity);
   p->id = *my_identity;
-  GNUNET_assert (p->ch == server);
   if (cls == &p1)
   {
     GNUNET_assert (ok == 2);
index 3041cccfeb8cd22595e0c482164f3b54f9a4bc8b..349c572b985c3d2103bc3e1fc0b62bce85b20df4 100644 (file)
@@ -1518,14 +1518,12 @@ GDS_NEIGHBOURS_handle_reply (const struct GNUNET_PeerIdentity *target,
  * To be called on core init/fail.
  *
  * @param cls service closure
- * @param server handle to the server for this service
  * @param identity the public identity of this peer
  */
 static void
-core_init (void *cls, struct GNUNET_CORE_Handle *server,
+core_init (void *cls,
            const struct GNUNET_PeerIdentity *identity)
 {
-  GNUNET_assert (server != NULL);
   my_identity = *identity;
 }
 
index 644ffb6558e6992289b21c177428d9340efbf53f..a1ce191cf7f6b72283357a3d8d2252f61d114819 100644 (file)
@@ -1801,11 +1801,10 @@ handle_start (void *cls, struct GNUNET_SERVER_Client *client,
  * Called on core init.
  *
  * @param cls unused
- * @param server legacy
  * @param identity this peer's identity
  */
 static void
-core_init (void *cls, struct GNUNET_CORE_Handle *server,
+core_init (void *cls,
            const struct GNUNET_PeerIdentity *identity)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
index 0590a1dec1e5d3a856f169124eec90a204a0ab9a..14d25b6c9b4ca1066a5bb21981b93e13b9ac4973 100644 (file)
@@ -172,21 +172,21 @@ static int is_me (const struct GNUNET_PeerIdentity *id)
  * Core startup callback
  *
  * @param cls unused
- * @param server core service's server handle
  * @param my_identity my id
  */
 static void
 core_startup_handler (void *cls,
-                                                                                       struct GNUNET_CORE_Handle *server,
                       const struct GNUNET_PeerIdentity *my_identity)
 {
-       me = *my_identity;
+  me = *my_identity;
 }
 
-void
+
+static void
 schedule_transmisson (struct NodeComCtx *e_ctx);
 
-size_t
+
+static size_t
 transmit_read_wrapper (void *cls, size_t bufsize, void *buf)
 {
        struct NodeComCtx *e_ctx = cls;
@@ -207,7 +207,8 @@ transmit_read_wrapper (void *cls, size_t bufsize, void *buf)
        return res;
 }
 
-void
+
+static void
 schedule_transmisson (struct NodeComCtx *e_ctx)
 {
        if (NULL != e_ctx->n->cth)
index a8fbda84bf99539af87909378f568eed4fa9c467..8ecb6bb6784dc3b115c8b1afce628936517892c4 100644 (file)
@@ -573,11 +573,10 @@ peer_connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer)
  * directly (which should work if you are authorized...).
  *
  * @param cls closure
- * @param server handle to the server, NULL if we failed
  * @param my_identity ID of this peer, NULL if we failed
  */
 static void
-peer_init_handler (void *cls, struct GNUNET_CORE_Handle *server,
+peer_init_handler (void *cls,
                    const struct GNUNET_PeerIdentity *my_identity)
 {
   my_id = *my_identity;
index f5ea6bba768cce269ad4fd4133b639db91c82126..c3543027a49c6c3abbf42056f5df365b3809abcd 100644 (file)
@@ -129,20 +129,22 @@ GNUNET_NETWORK_STRUCT_END
 
 static struct GNUNET_PeerIdentity me;
 
+
 static void
-core_init (void *cls, struct GNUNET_CORE_Handle *server,
+core_init (void *cls,
            const struct GNUNET_PeerIdentity *my_identity)
 {
   me = *my_identity;
 }
 
+
 /**
  * Core handler for p2p hostlist advertisements
  *
  * @param cls closure
  * @param peer identity of the sender
  * @param message advertisement message we got
- * @return GNUNET_OK on success
+ * @return #GNUNET_OK on success
  */
 static int
 advertisement_handler (void *cls, const struct GNUNET_PeerIdentity *peer,
index ea8391d4e01fd527e6367fabd0090442bb53c0a5..7fc77d094310d83c47cbbced93f92c954bcfea12 100644 (file)
@@ -127,12 +127,9 @@ struct GNUNET_CORE_MessageHandler
  * do this later).
  *
  * @param cls closure
- * @param server handle to the server, NULL if we failed;
- *        TODO: consider removing this argument, it is redundant...
  * @param my_identity ID of this peer, NULL if we failed
  */
 typedef void (*GNUNET_CORE_StartupCallback) (void *cls,
-                                             struct GNUNET_CORE_Handle * server,
                                              const struct GNUNET_PeerIdentity *my_identity);
 
 
index 5bfe39e9ab27165189309d730a90791dd3d161e6..9010044ccf5833478f1f7c5b2709c832f46d2777 100644 (file)
@@ -948,8 +948,8 @@ core_disconnect_cb (void *cls,
 }
 
 static void
-core_init_cb (void *cls, struct GNUNET_CORE_Handle *server,
-                   const struct GNUNET_PeerIdentity *my_identity)
+core_init_cb (void *cls, 
+             const struct GNUNET_PeerIdentity *my_identity)
 {
   my_peer_id = *my_identity;
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connected to core service\n");
index d770490b38f1cab36c6889996d819c2c1ee0d67b..510a08d1434d16a8c16112eba70e0a2a11224741 100644 (file)
@@ -6649,20 +6649,17 @@ server_init (void)
  * To be called on core init/fail.
  *
  * @param cls Closure (config)
- * @param server handle to the server for this service
  * @param identity the public identity of this peer
  */
 static void
-core_init (void *cls, struct GNUNET_CORE_Handle *server,
+core_init (void *cls, 
            const struct GNUNET_PeerIdentity *identity)
 {
   const struct GNUNET_CONFIGURATION_Handle *c = cls;
   static int i = 0;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Core init\n");
-  GNUNET_break (core_handle == server);
-  if (0 != memcmp (identity, &my_full_id, sizeof (my_full_id)) ||
-    NULL == server)
+  if (0 != memcmp (identity, &my_full_id, sizeof (my_full_id)))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Wrong CORE service\n"));
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
index 1893c230461610975cc9427273c058b2fd364545..130c7df1429b80d00a03cb2786dc715995340a3b 100644 (file)
@@ -5619,20 +5619,17 @@ server_init (void)
  * To be called on core init/fail.
  *
  * @param cls Closure (config)
- * @param server handle to the server for this service
  * @param identity the public identity of this peer
  */
 static void
-core_init (void *cls, struct GNUNET_CORE_Handle *server,
+core_init (void *cls, 
            const struct GNUNET_PeerIdentity *identity)
 {
   const struct GNUNET_CONFIGURATION_Handle *c = cls;
   static int i = 0;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Core init\n");
-  GNUNET_break (core_handle == server);
-  if (0 != memcmp (identity, &my_full_id, sizeof (my_full_id)) ||
-    NULL == server)
+  if (0 != memcmp (identity, &my_full_id, sizeof (my_full_id)))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Wrong CORE service\n"));
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
index b26305ce37f60c2862596ea9d299644f56239831..7aabca6b5245c03321ce5b9c195952618cb33d99 100644 (file)
@@ -1340,17 +1340,16 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  * Called on core init/fail.
  *
  * @param cls service closure
- * @param server handle to the server for this service
  * @param identity the public identity of this peer
  */
 static void
-core_init (void *cls, struct GNUNET_CORE_Handle *server,
+core_init (void *cls, 
            const struct GNUNET_PeerIdentity *identity)
 {
   struct GNUNET_TIME_Absolute now;
   struct GNUNET_TIME_Absolute prev_time;
 
-  if (NULL == server)
+  if (NULL == identity)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Connection to core FAILED!\n");
     GNUNET_SCHEDULER_shutdown ();
index c50288f2dc9232560810f9e012835b31edc53360..8cae56076e21901246ecc5abc10a4c9610b053fd 100644 (file)
@@ -607,11 +607,10 @@ oprelease_get_handle_transport (void *cls)
  * do this later).
  *
  * @param cls closure
- * @param server handle to the server, NULL if we failed
  * @param my_identity ID of this peer, NULL if we failed
  */
 static void
-core_startup_cb (void *cls, struct GNUNET_CORE_Handle *server,
+core_startup_cb (void *cls, 
                  const struct GNUNET_PeerIdentity *my_identity)
 {
   struct CacheEntry *entry = cls;
@@ -622,9 +621,8 @@ core_startup_cb (void *cls, struct GNUNET_CORE_Handle *server,
     return;
   }
   GNUNET_assert (NULL == entry->peer_identity);
-  GNUNET_break (NULL != server);
-  entry->core_handle = server;
-  entry->peer_identity = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity));
+  // FIXME: why is this dynamically allocated?
+  entry->peer_identity = GNUNET_new (struct GNUNET_PeerIdentity);
   memcpy (entry->peer_identity, my_identity,
           sizeof (struct GNUNET_PeerIdentity));
   if (0 == entry->demand)
index 6687ee02a9007717c933799affd0d10aaea90f9d..372659bbc838a46bb60e9ef498ea370bd306ea86 100644 (file)
@@ -969,18 +969,17 @@ process_peer (void *cls, const struct GNUNET_PeerIdentity *peer,
 
 
 /**
- * Function called after GNUNET_CORE_connect has succeeded
+ * Function called after #GNUNET_CORE_connect has succeeded
  * (or failed for good).
  *
  * @param cls closure
- * @param server handle to the server, NULL if we failed
  * @param my_id ID of this peer, NULL if we failed
  */
 static void
-core_init (void *cls, struct GNUNET_CORE_Handle *server,
+core_init (void *cls, 
            const struct GNUNET_PeerIdentity *my_id)
 {
-  if (server == NULL)
+  if (NULL == my_id)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 _
@@ -988,10 +987,12 @@ core_init (void *cls, struct GNUNET_CORE_Handle *server,
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
-  handle = server;
   my_identity = *my_id;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I am peer `%s'\n", GNUNET_i2s (my_id));
-  peerinfo_notify = GNUNET_PEERINFO_notify (cfg, GNUNET_NO, &process_peer, NULL);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
+             "I am peer `%s'\n", 
+             GNUNET_i2s (my_id));
+  peerinfo_notify = GNUNET_PEERINFO_notify (cfg, GNUNET_NO, 
+                                           &process_peer, NULL);
 }