From: Christian Grothoff Date: Thu, 11 Nov 2010 11:05:29 +0000 (+0000) Subject: adding argument to GNUNET_CORE_connect -- not yet implemented X-Git-Tag: initial-import-from-subversion-38251~19769 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1b18069ef2567ffe0994c799d1d179329d629ca9;p=oweals%2Fgnunet.git adding argument to GNUNET_CORE_connect -- not yet implemented --- diff --git a/configure.ac b/configure.ac index eddb10ff0..8c747d283 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/src/core/core_api.c b/src/core/core_api.c index cb5ba3ecb..a1e6aea65 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c @@ -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) { diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index 65b09c835..129184587 100644 --- a/src/core/test_core_api.c +++ b/src/core/test_core_api.c @@ -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, diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c index da67bb4d4..f22a9022e 100644 --- a/src/core/test_core_api_reliability.c +++ b/src/core/test_core_api_reliability.c @@ -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, diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c index da7217f39..e39179196 100644 --- a/src/core/test_core_api_start_only.c +++ b/src/core/test_core_api_start_only.c @@ -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, diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index 822dc2c46..5a3e3dc14 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c @@ -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, diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c index ae57c0ea7..714ba4753 100644 --- a/src/dht/gnunet-service-dht.c +++ b/src/dht/gnunet-service-dht.c @@ -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 */ diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index cfc1cd2d1..6001e33f4 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c @@ -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, diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c index f53aa48f9..d4c7eef2c 100644 --- a/src/dv/test_transport_api_dv.c +++ b/src/dv/test_transport_api_dv.c @@ -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; diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 6889fb703..1cb5432c7 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -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, diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index f41f0add0..8c3bb9be7 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c @@ -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, diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c index 7e2e2ac9e..d64fdf587 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c @@ -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, diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index 7fe871741..9c102988b 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h @@ -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 diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c index d1172916e..87f90f80f 100644 --- a/src/testing/test_testing_topology.c +++ b/src/testing/test_testing_topology.c @@ -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, diff --git a/src/testing/testing.c b/src/testing/testing.c index cf53c4a2e..d178995e0 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c @@ -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, diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index b8bad46a6..49f460658 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c @@ -1378,6 +1378,7 @@ run (void *cls, NULL, NULL); handle = GNUNET_CORE_connect (cfg, + 1, GNUNET_TIME_UNIT_FOREVER_REL, NULL, &core_init,