adding argument to GNUNET_CORE_connect -- not yet implemented
authorChristian Grothoff <christian@grothoff.org>
Thu, 11 Nov 2010 11:05:29 +0000 (11:05 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 11 Nov 2010 11:05:29 +0000 (11:05 +0000)
16 files changed:
configure.ac
src/core/core_api.c
src/core/test_core_api.c
src/core/test_core_api_reliability.c
src/core/test_core_api_start_only.c
src/core/test_core_quota_compliance.c
src/dht/gnunet-service-dht.c
src/dv/gnunet-service-dv.c
src/dv/test_transport_api_dv.c
src/fs/gnunet-service-fs.c
src/hostlist/gnunet-daemon-hostlist.c
src/hostlist/test_gnunet_daemon_hostlist_learning.c
src/include/gnunet_core_service.h
src/testing/test_testing_topology.c
src/testing/testing.c
src/topology/gnunet-daemon-topology.c

index eddb10ff05d3a6d6f42d61a48a07d93cfc7c7b32..8c747d283bbbeb8b35e3ac0e5ec4230ebe5ebc22 100644 (file)
@@ -21,8 +21,8 @@
 #
 #
 AC_PREREQ(2.61)
-AC_INIT([gnunet], [0.9.0pre1],[bug-gnunet@gnu.org])
-AM_INIT_AUTOMAKE([gnunet], [0.9.0pre1])
+AC_INIT([gnunet], [0.9.0pre2],[bug-gnunet@gnu.org])
+AM_INIT_AUTOMAKE([gnunet], [0.9.0pre2])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 AC_CONFIG_HEADERS([gnunet_config.h])
 
index cb5ba3ecb0407d43b59130ef5b7771c1b67ad99c..a1e6aea6556e14854c705848c3d93542d1bdc68a 100644 (file)
@@ -128,6 +128,11 @@ struct GNUNET_CORE_Handle
    */
   GNUNET_SCHEDULER_TaskIdentifier reconnect_task;
 
+  /**
+   * Number of messages we should queue per target.
+   */
+  unsigned int queue_size;
+
   /**
    * Number of entries in the handlers array.
    */
@@ -722,6 +727,7 @@ transmit_start (void *cls, size_t size, void *buf)
  * complete (or fail) asynchronously.
  *
  * @param cfg configuration to use
+ * @param queue_size size of the per-peer message queue
  * @param timeout after how long should we give up trying to connect to the core service?
  * @param cls closure for the various callbacks that follow (including handlers in the handlers array)
  * @param init callback to call on timeout or once we have successfully
@@ -743,6 +749,7 @@ transmit_start (void *cls, size_t size, void *buf)
  */
 struct GNUNET_CORE_Handle *
 GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                    unsigned int queue_size,
                      struct GNUNET_TIME_Relative timeout,
                      void *cls,
                      GNUNET_CORE_StartupCallback init,
@@ -769,6 +776,7 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
   h->inbound_hdr_only = inbound_hdr_only;
   h->outbound_hdr_only = outbound_hdr_only;
   h->handlers = handlers;
+  h->queue_size = queue_size;
   h->client_notifications = GNUNET_CLIENT_connect ("core", cfg);
   if (h->client_notifications == NULL)
     {
index 65b09c8353fe0f85429ffe6ce823c17fc12840b2..1291845877a079eef128c1eb1989595a546a2787 100644 (file)
@@ -219,7 +219,7 @@ init_notify (void *cls,
       GNUNET_assert (ok == 2);
       OKPP;
       /* connect p2 */
-      GNUNET_CORE_connect (p2.cfg,
+      GNUNET_CORE_connect (p2.cfg, 1,
                            TIMEOUT,
                            &p2,
                            &init_notify,                        
@@ -310,7 +310,7 @@ run (void *cls,
   OKPP;
   setup_peer (&p1, "test_core_api_peer1.conf");
   setup_peer (&p2, "test_core_api_peer2.conf");
-  GNUNET_CORE_connect (p1.cfg,
+  GNUNET_CORE_connect (p1.cfg, 1,
                        TIMEOUT,
                        &p1,
                        &init_notify,
index da67bb4d435e5f046d3eaf6f96a9fdd9b333aa24..f22a9022e7c96a24b621679a1f71b949d8b3d558 100644 (file)
@@ -365,7 +365,7 @@ init_notify (void *cls,
       GNUNET_assert (ok == 2);
       OKPP;
       /* connect p2 */
-      GNUNET_CORE_connect (p2.cfg,
+      GNUNET_CORE_connect (p2.cfg, 1,
                            TIMEOUT,
                            &p2,
                            &init_notify,                        
@@ -455,7 +455,7 @@ run (void *cls,
   OKPP;
   setup_peer (&p1, "test_core_api_peer1.conf");
   setup_peer (&p2, "test_core_api_peer2.conf");
-  GNUNET_CORE_connect (p1.cfg,
+  GNUNET_CORE_connect (p1.cfg, 1,
                        TIMEOUT,
                        &p1,
                        &init_notify,
index da7217f397c81db6135213e03a9e2d09298be659..e39179196a42abbcce7eedc076b73abf2c52fa3e 100644 (file)
@@ -125,7 +125,7 @@ init_notify (void *cls,
   if (cls == &p1)
     {
       /* connect p2 */
-      GNUNET_CORE_connect (p2.cfg,
+      GNUNET_CORE_connect (p2.cfg, 1,
                            TIMEOUT,
                            &p2,
                            &init_notify,                        
@@ -172,7 +172,7 @@ run (void *cls,
   OKPP;
   setup_peer (&p1, "test_core_api_peer1.conf");
   setup_peer (&p2, "test_core_api_peer2.conf");
-  GNUNET_CORE_connect (p1.cfg,
+  GNUNET_CORE_connect (p1.cfg, 1,
                        TIMEOUT,
                        &p1,
                        &init_notify,
index 822dc2c46f1261fa5fd9e5ec612f4972da510941..5a3e3dc147b722a3d203670dde77d66787787451 100644 (file)
@@ -452,7 +452,7 @@ init_notify (void *cls,
       GNUNET_assert (ok == 2);
       OKPP;
       /* connect p2 */
-      GNUNET_CORE_connect (p2.cfg,
+      GNUNET_CORE_connect (p2.cfg, 1,
                            TIMEOUT,
                            &p2,
                            &init_notify,                        
@@ -533,7 +533,7 @@ run (void *cls,
   OKPP;
   setup_peer (&p1, "test_core_quota_peer1.conf");
   setup_peer (&p2, "test_core_quota_peer2.conf");
-  GNUNET_CORE_connect (p1.cfg,
+  GNUNET_CORE_connect (p1.cfg, 1,
                        TIMEOUT,
                        &p1,
                        &init_notify,
index ae57c0ea7236487f39483f9c7bcae95deeb1f841..714ba47530863ab286608d63e948b49b222b1697 100644 (file)
@@ -4567,7 +4567,8 @@ run (void *cls,
   datacache = GNUNET_DATACACHE_create (cfg, "dhtcache");
   GNUNET_SERVER_add_handlers (server, plugin_handlers);
   GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL);
-  coreAPI = GNUNET_CORE_connect (cfg,   /* Main configuration */
+  coreAPI = GNUNET_CORE_connect (cfg,    /* Main configuration */
+                                1, /* queue size */
                                  GNUNET_TIME_UNIT_FOREVER_REL,
                                  NULL,  /* Closure passed to DHT functions */
                                  &core_init,    /* Call core_init once connected */
index cfc1cd2d19c5bf4e1fa2acfd10649ccc5498722d..6001e33f4a00e645267193f3347da07ed320af49 100644 (file)
@@ -2993,6 +2993,7 @@ run (void *cls,
   GNUNET_SERVER_add_handlers (server, plugin_handlers);
   coreAPI =
   GNUNET_CORE_connect (cfg,
+                      1,
                        GNUNET_TIME_relative_get_forever(),
                        NULL, /* FIXME: anything we want to pass around? */
                        &core_init,
index f53aa48f96d5526de5c7b09562c1994c83156208..d4c7eef2caa41bcf0dd540f0e7495cd843ff4bc7 100644 (file)
@@ -529,6 +529,7 @@ init_notify_peer1 (void *cls,
    * Connect to the receiving peer
    */
   pos->peer2handle = GNUNET_CORE_connect (pos->peer2->cfg,
+                                         1, 
                                          TIMEOUT,
                                          pos,
                                          &init_notify_peer2,
@@ -567,6 +568,7 @@ send_test_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
    * Connect to the sending peer
    */
   pos->peer1handle = GNUNET_CORE_connect (pos->peer1->cfg,
+                                         1,
                                           TIMEOUT,
                                           pos,
                                           &init_notify_peer1,
@@ -880,7 +882,14 @@ peers_started_callback (void *cls,
   GNUNET_assert(GNUNET_SYSERR != GNUNET_CONTAINER_multihashmap_put(peer_daemon_hash, &id->hashPubKey, d, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
 
   new_peer = GNUNET_malloc(sizeof(struct PeerContext));
-  new_peer->peer_handle = GNUNET_CORE_connect(cfg, GNUNET_TIME_UNIT_FOREVER_REL, d, NULL, &all_connect_handler, NULL, NULL, NULL, GNUNET_NO, NULL, GNUNET_NO, no_handlers);
+  new_peer->peer_handle = GNUNET_CORE_connect(cfg, 
+                                             1,
+                                             GNUNET_TIME_UNIT_FOREVER_REL,
+                                             d, NULL,
+                                             &all_connect_handler, 
+                                             NULL, NULL, NULL, 
+                                             GNUNET_NO, NULL, GNUNET_NO,
+                                             no_handlers);
   new_peer->daemon = d;
   new_peer->next = all_peers;
   all_peers = new_peer;
index 6889fb703920592d27a888837f16f0205f761342..1cb5432c7d6e83205bf6db89f667823ef5c09987 100644 (file)
@@ -4488,6 +4488,7 @@ main_init (struct GNUNET_SERVER_Handle *server,
   peer_request_map = GNUNET_CONTAINER_multihashmap_create (enc);
   requests_by_expiration_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); 
   core = GNUNET_CORE_connect (cfg,
+                             1, /* larger? */
                              GNUNET_TIME_UNIT_FOREVER_REL,
                              NULL,
                              NULL,
index f41f0add0b6e71b95e107d39562f2412a20f41a2..8c3bb9be763608667bf7e66960efc3974a86dcee 100644 (file)
@@ -269,6 +269,7 @@ run (void *cls,
   stats = GNUNET_STATISTICS_create ("hostlist", cfg);
 
   core = GNUNET_CORE_connect (cfg,
+                             1,
                              GNUNET_TIME_UNIT_FOREVER_REL,
                              NULL,
                              &core_init,
index 7e2e2ac9e4d134d90921cd88cc0e290bf2eb60c4..d64fdf5872e8bfb047c0745e6458910553d4169a 100644 (file)
@@ -370,6 +370,7 @@ setup_learn_peer (struct PeerContext *p, const char *cfgname)
   if ( NULL != filename)  GNUNET_free ( filename );
 
   p->core = GNUNET_CORE_connect (p->cfg,
+                                1,
                                 GNUNET_TIME_UNIT_FOREVER_REL,
                                 NULL,
                                 NULL,
index 7fe871741a37f24068142aba93c6e5ac141c3de2..9c102988bec317fdecca90eb77ff3f2a864dc350 100644 (file)
@@ -179,6 +179,7 @@ typedef void
  * subject to queue size limitations.
  *
  * @param cfg configuration to use
+ * @param queue_size size of the per-peer message queue
  * @param timeout after how long should we give up trying to connect to the core service?
  * @param cls closure for the various callbacks that follow (including handlers in the handlers array)
  * @param init callback to call on timeout or once we have successfully
@@ -215,6 +216,7 @@ typedef void
  */
 struct GNUNET_CORE_Handle *
 GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                    unsigned int queue_size,
                      struct GNUNET_TIME_Relative timeout,
                      void *cls,
                      GNUNET_CORE_StartupCallback init,
@@ -384,7 +386,10 @@ struct GNUNET_CORE_TransmitHandle;
  * @param target who should receive the message,
  *        use NULL for this peer (loopback)
  * @param notify_size how many bytes of buffer space does notify want?
- * @param notify function to call when buffer space is available
+ * @param notify function to call when buffer space is available;
+ *        will be called with NULL on timeout or if the overall queue
+ *        for this peer is larger than queue_size and this is currently
+ *        the message with the lowest priority
  * @param notify_cls closure for notify
  * @return non-NULL if the notify callback was queued,
  *         NULL if we can not even queue the request (insufficient
index d1172916e6a7ac2002ae123ea51386586fe63bee..87f90f80f43aa588065771ca2c7d2caaa7738bbc 100644 (file)
@@ -521,6 +521,7 @@ init_notify_peer1 (void *cls,
    * Connect to the receiving peer
    */
   pos->peer2handle = GNUNET_CORE_connect (pos->peer2->cfg,
+                                         1,
                                          TIMEOUT,
                                          pos,
                                          &init_notify_peer2,
@@ -562,6 +563,7 @@ send_test_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
    * Connect to the sending peer
    */
   pos->peer1handle = GNUNET_CORE_connect (pos->peer1->cfg,
+                                         1,
                                           TIMEOUT,
                                           pos,
                                           &init_notify_peer1,
index cf53c4a2e07ccfc50188c40f13a7eb70c69a964e..d178995e0ad2d26fe5d8761eee265750a29587d2 100644 (file)
@@ -544,6 +544,7 @@ start_fsm (void *cls,
 #endif
       d->phase = SP_START_CORE;
       d->server = GNUNET_CORE_connect (d->cfg,
+                                      1,
                                        ARM_START_WAIT,
                                        d,
                                        &testing_init,
@@ -1537,6 +1538,7 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1,
 #endif
 
   ctx->d1core = GNUNET_CORE_connect (d1->cfg,
+                                    1,
                                      timeout,
                                      ctx,
                                      NULL,
@@ -1554,6 +1556,7 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1,
 
 #if CONNECT_CORE2
   ctx->d2core = GNUNET_CORE_connect (d2->cfg,
+                                    1,
                                      timeout,
                                      ctx,
                                      NULL,
@@ -1616,6 +1619,7 @@ reattempt_daemons_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext
   GNUNET_assert(ctx->d1core == NULL);
 
   ctx->d1core = GNUNET_CORE_connect (ctx->d1->cfg,
+                                    1,
                                      GNUNET_TIME_absolute_get_remaining(ctx->timeout),
                                      ctx,
                                      NULL,
index b8bad46a6757ac9680d9736f1af3d773f2465af4..49f4606588a0ac7fbdd5cd1dc663c94abd63dcee 100644 (file)
@@ -1378,6 +1378,7 @@ run (void *cls,
                                        NULL,
                                        NULL);
   handle = GNUNET_CORE_connect (cfg,
+                               1,
                                GNUNET_TIME_UNIT_FOREVER_REL,
                                NULL,
                                &core_init,