diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-06-09 14:53:44 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-06-09 14:53:44 +0000 |
commit | 7ae3bcd234e062c28f66db9758f61af401d0a707 (patch) | |
tree | adb1da7611b0afd6ff0fa094a6f6bc7ebabd174e /src | |
parent | 006eb1c4f3307fe89c786c2f1ac866611e33d3cd (diff) | |
download | gnunet-7ae3bcd234e062c28f66db9758f61af401d0a707.tar.gz gnunet-7ae3bcd234e062c28f66db9758f61af401d0a707.zip |
-simplifying core API (#2400)
Diffstat (limited to 'src')
-rw-r--r-- | src/chat/gnunet-service-chat.c | 3 | ||||
-rw-r--r-- | src/core/core_api.c | 22 | ||||
-rw-r--r-- | src/core/test_core_api.c | 4 | ||||
-rw-r--r-- | src/core/test_core_api_reliability.c | 4 | ||||
-rw-r--r-- | src/core/test_core_api_send_to_self.c | 2 | ||||
-rw-r--r-- | src/core/test_core_api_start_only.c | 4 | ||||
-rw-r--r-- | src/core/test_core_quota_compliance.c | 4 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht_neighbours.c | 2 | ||||
-rw-r--r-- | src/dv/gnunet-service-dv.c | 2 | ||||
-rw-r--r-- | src/dv/test_transport_api_dv.c | 6 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs.c | 2 | ||||
-rw-r--r-- | src/hostlist/gnunet-daemon-hostlist.c | 2 | ||||
-rw-r--r-- | src/hostlist/test_gnunet_daemon_hostlist_learning.c | 2 | ||||
-rw-r--r-- | src/include/gnunet_core_service.h | 29 | ||||
-rw-r--r-- | src/integration-tests/connection_watchdog.c | 2 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 1 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_new.c | 1 | ||||
-rw-r--r-- | src/nse/gnunet-service-nse.c | 2 | ||||
-rw-r--r-- | src/testing/test_testing_large_topology.c | 4 | ||||
-rw-r--r-- | src/testing/test_testing_topology.c | 4 | ||||
-rw-r--r-- | src/testing/testing.c | 4 | ||||
-rw-r--r-- | src/topology/gnunet-daemon-topology.c | 2 |
22 files changed, 54 insertions, 54 deletions
diff --git a/src/chat/gnunet-service-chat.c b/src/chat/gnunet-service-chat.c index fb127b2f0..3405659a9 100644 --- a/src/chat/gnunet-service-chat.c +++ b/src/chat/gnunet-service-chat.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #define DEBUG_CHAT_SERVICE GNUNET_EXTRA_LOGGING | 36 | #define DEBUG_CHAT_SERVICE GNUNET_EXTRA_LOGGING |
37 | #define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) | 37 | #define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) |
38 | #define EXPECTED_NEIGHBOUR_COUNT 16 | 38 | #define EXPECTED_NEIGHBOUR_COUNT 16 |
39 | #define QUEUE_SIZE 16 | ||
40 | #define MAX_ANONYMOUS_MSG_LIST_LENGTH 16 | 39 | #define MAX_ANONYMOUS_MSG_LIST_LENGTH 16 |
41 | 40 | ||
42 | 41 | ||
@@ -1710,7 +1709,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1710 | GNUNET_CONTAINER_multihashmap_create (EXPECTED_NEIGHBOUR_COUNT); | 1709 | GNUNET_CONTAINER_multihashmap_create (EXPECTED_NEIGHBOUR_COUNT); |
1711 | GNUNET_SERVER_add_handlers (server, handlers); | 1710 | GNUNET_SERVER_add_handlers (server, handlers); |
1712 | core = | 1711 | core = |
1713 | GNUNET_CORE_connect (cfg, QUEUE_SIZE, NULL, &core_init, | 1712 | GNUNET_CORE_connect (cfg, NULL, &core_init, |
1714 | &peer_connect_handler, &peer_disconnect_handler, | 1713 | &peer_connect_handler, &peer_disconnect_handler, |
1715 | NULL, GNUNET_NO, NULL, GNUNET_NO, p2p_handlers); | 1714 | NULL, GNUNET_NO, NULL, GNUNET_NO, p2p_handlers); |
1716 | GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL); | 1715 | GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL); |
diff --git a/src/core/core_api.c b/src/core/core_api.c index 526dc9fff..2b6407b6e 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -1158,7 +1158,6 @@ reconnect (struct GNUNET_CORE_Handle *h) | |||
1158 | * complete (or fail) asynchronously. | 1158 | * complete (or fail) asynchronously. |
1159 | * | 1159 | * |
1160 | * @param cfg configuration to use | 1160 | * @param cfg configuration to use |
1161 | * @param queue_size size of the per-peer message queue | ||
1162 | * @param cls closure for the various callbacks that follow (including handlers in the handlers array) | 1161 | * @param cls closure for the various callbacks that follow (including handlers in the handlers array) |
1163 | * @param init callback to call once we have successfully | 1162 | * @param init callback to call once we have successfully |
1164 | * connected to the core service | 1163 | * connected to the core service |
@@ -1178,7 +1177,7 @@ reconnect (struct GNUNET_CORE_Handle *h) | |||
1178 | */ | 1177 | */ |
1179 | struct GNUNET_CORE_Handle * | 1178 | struct GNUNET_CORE_Handle * |
1180 | GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 1179 | GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
1181 | unsigned int queue_size, void *cls, | 1180 | void *cls, |
1182 | GNUNET_CORE_StartupCallback init, | 1181 | GNUNET_CORE_StartupCallback init, |
1183 | GNUNET_CORE_ConnectEventHandler connects, | 1182 | GNUNET_CORE_ConnectEventHandler connects, |
1184 | GNUNET_CORE_DisconnectEventHandler disconnects, | 1183 | GNUNET_CORE_DisconnectEventHandler disconnects, |
@@ -1192,7 +1191,7 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1192 | 1191 | ||
1193 | h = GNUNET_malloc (sizeof (struct GNUNET_CORE_Handle)); | 1192 | h = GNUNET_malloc (sizeof (struct GNUNET_CORE_Handle)); |
1194 | h->cfg = cfg; | 1193 | h->cfg = cfg; |
1195 | h->queue_size = queue_size; | 1194 | h->queue_size = 1; // FIXME: remove entirely... |
1196 | h->cls = cls; | 1195 | h->cls = cls; |
1197 | h->init = init; | 1196 | h->init = init; |
1198 | h->connects = connects; | 1197 | h->connects = connects; |
@@ -1285,9 +1284,13 @@ run_request_next_transmission (void *cls, | |||
1285 | 1284 | ||
1286 | /** | 1285 | /** |
1287 | * Ask the core to call "notify" once it is ready to transmit the | 1286 | * Ask the core to call "notify" once it is ready to transmit the |
1288 | * given number of bytes to the specified "target". Must only be | 1287 | * given number of bytes to the specified "target". Must only be |
1289 | * called after a connection to the respective peer has been | 1288 | * called after a connection to the respective peer has been |
1290 | * established (and the client has been informed about this). | 1289 | * established (and the client has been informed about this). You may |
1290 | * have one request of this type pending for each connected peer at | ||
1291 | * any time. If a peer disconnects, the application MUST call | ||
1292 | * "GNUNET_CORE_notify_transmit_ready_cancel" on the respective | ||
1293 | * transmission request, if one such request is pending. | ||
1291 | * | 1294 | * |
1292 | * @param handle connection to core service | 1295 | * @param handle connection to core service |
1293 | * @param cork is corking allowed for this transmission? | 1296 | * @param cork is corking allowed for this transmission? |
@@ -1295,11 +1298,14 @@ run_request_next_transmission (void *cls, | |||
1295 | * @param maxdelay how long can the message wait? | 1298 | * @param maxdelay how long can the message wait? |
1296 | * @param target who should receive the message, never NULL (can be this peer's identity for loopback) | 1299 | * @param target who should receive the message, never NULL (can be this peer's identity for loopback) |
1297 | * @param notify_size how many bytes of buffer space does notify want? | 1300 | * @param notify_size how many bytes of buffer space does notify want? |
1298 | * @param notify function to call when buffer space is available | 1301 | * @param notify function to call when buffer space is available; |
1302 | * will be called with NULL on timeout; clients MUST cancel | ||
1303 | * all pending transmission requests DURING the disconnect | ||
1304 | * handler | ||
1299 | * @param notify_cls closure for notify | 1305 | * @param notify_cls closure for notify |
1300 | * @return non-NULL if the notify callback was queued, | 1306 | * @return non-NULL if the notify callback was queued, |
1301 | * NULL if we can not even queue the request (insufficient | 1307 | * NULL if we can not even queue the request (request already pending); |
1302 | * memory); if NULL is returned, "notify" will NOT be called. | 1308 | * if NULL is returned, "notify" will NOT be called. |
1303 | */ | 1309 | */ |
1304 | struct GNUNET_CORE_TransmitHandle * | 1310 | struct GNUNET_CORE_TransmitHandle * |
1305 | GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork, | 1311 | GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork, |
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index 37d166983..d1591328f 100644 --- a/src/core/test_core_api.c +++ b/src/core/test_core_api.c | |||
@@ -299,7 +299,7 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server, | |||
299 | OKPP; | 299 | OKPP; |
300 | /* connect p2 */ | 300 | /* connect p2 */ |
301 | p2.ch = | 301 | p2.ch = |
302 | GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify, | 302 | GNUNET_CORE_connect (p2.cfg, &p2, &init_notify, &connect_notify, |
303 | &disconnect_notify, &inbound_notify, GNUNET_YES, | 303 | &disconnect_notify, &inbound_notify, GNUNET_YES, |
304 | &outbound_notify, GNUNET_YES, handlers); | 304 | &outbound_notify, GNUNET_YES, handlers); |
305 | } | 305 | } |
@@ -346,7 +346,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
346 | (GNUNET_TIME_UNIT_SECONDS, 300), | 346 | (GNUNET_TIME_UNIT_SECONDS, 300), |
347 | &terminate_task_error, NULL); | 347 | &terminate_task_error, NULL); |
348 | p1.ch = | 348 | p1.ch = |
349 | GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify, | 349 | GNUNET_CORE_connect (p1.cfg, &p1, &init_notify, &connect_notify, |
350 | &disconnect_notify, &inbound_notify, GNUNET_YES, | 350 | &disconnect_notify, &inbound_notify, GNUNET_YES, |
351 | &outbound_notify, GNUNET_YES, handlers); | 351 | &outbound_notify, GNUNET_YES, handlers); |
352 | } | 352 | } |
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c index e18d8c4fd..682424f89 100644 --- a/src/core/test_core_api_reliability.c +++ b/src/core/test_core_api_reliability.c | |||
@@ -384,7 +384,7 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server, | |||
384 | GNUNET_assert (ok == 2); | 384 | GNUNET_assert (ok == 2); |
385 | OKPP; | 385 | OKPP; |
386 | /* connect p2 */ | 386 | /* connect p2 */ |
387 | GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify, | 387 | GNUNET_CORE_connect (p2.cfg, &p2, &init_notify, &connect_notify, |
388 | &disconnect_notify, &inbound_notify, GNUNET_YES, | 388 | &disconnect_notify, &inbound_notify, GNUNET_YES, |
389 | &outbound_notify, GNUNET_YES, handlers); | 389 | &outbound_notify, GNUNET_YES, handlers); |
390 | } | 390 | } |
@@ -450,7 +450,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
450 | setup_peer (&p2, "test_core_api_peer2.conf"); | 450 | setup_peer (&p2, "test_core_api_peer2.conf"); |
451 | err_task = | 451 | err_task = |
452 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &terminate_task_error, NULL); | 452 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &terminate_task_error, NULL); |
453 | GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify, | 453 | GNUNET_CORE_connect (p1.cfg, &p1, &init_notify, &connect_notify, |
454 | &disconnect_notify, &inbound_notify, GNUNET_YES, | 454 | &disconnect_notify, &inbound_notify, GNUNET_YES, |
455 | &outbound_notify, GNUNET_YES, handlers); | 455 | &outbound_notify, GNUNET_YES, handlers); |
456 | } | 456 | } |
diff --git a/src/core/test_core_api_send_to_self.c b/src/core/test_core_api_send_to_self.c index b1340dcfb..3827cdb77 100644 --- a/src/core/test_core_api_send_to_self.c +++ b/src/core/test_core_api_send_to_self.c | |||
@@ -182,7 +182,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
182 | "test_core_api_peer1.conf")); | 182 | "test_core_api_peer1.conf")); |
183 | 183 | ||
184 | core = | 184 | core = |
185 | GNUNET_CORE_connect (core_cfg, 42, NULL, &init, &connect_cb, NULL, NULL, | 185 | GNUNET_CORE_connect (core_cfg, NULL, &init, &connect_cb, NULL, NULL, |
186 | 0, NULL, 0, handlers); | 186 | 0, NULL, 0, handlers); |
187 | 187 | ||
188 | die_task = | 188 | die_task = |
diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c index 8c8132043..308814b21 100644 --- a/src/core/test_core_api_start_only.c +++ b/src/core/test_core_api_start_only.c | |||
@@ -129,7 +129,7 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server, | |||
129 | { | 129 | { |
130 | /* connect p2 */ | 130 | /* connect p2 */ |
131 | p2.ch = | 131 | p2.ch = |
132 | GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify, | 132 | GNUNET_CORE_connect (p2.cfg, &p2, &init_notify, &connect_notify, |
133 | &disconnect_notify, &inbound_notify, GNUNET_YES, | 133 | &disconnect_notify, &inbound_notify, GNUNET_YES, |
134 | &outbound_notify, GNUNET_YES, handlers); | 134 | &outbound_notify, GNUNET_YES, handlers); |
135 | } | 135 | } |
@@ -191,7 +191,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
191 | (GNUNET_TIME_UNIT_MINUTES, TIMEOUT), | 191 | (GNUNET_TIME_UNIT_MINUTES, TIMEOUT), |
192 | &timeout_task, NULL); | 192 | &timeout_task, NULL); |
193 | p1.ch = | 193 | p1.ch = |
194 | GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify, | 194 | GNUNET_CORE_connect (p1.cfg, &p1, &init_notify, &connect_notify, |
195 | &disconnect_notify, &inbound_notify, GNUNET_YES, | 195 | &disconnect_notify, &inbound_notify, GNUNET_YES, |
196 | &outbound_notify, GNUNET_YES, handlers); | 196 | &outbound_notify, GNUNET_YES, handlers); |
197 | } | 197 | } |
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index df602b37f..bee8c02b4 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c | |||
@@ -527,7 +527,7 @@ init_notify (void *cls, struct GNUNET_CORE_Handle *server, | |||
527 | OKPP; | 527 | OKPP; |
528 | /* connect p2 */ | 528 | /* connect p2 */ |
529 | p2.ch = | 529 | p2.ch = |
530 | GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify, | 530 | GNUNET_CORE_connect (p2.cfg, &p2, &init_notify, &connect_notify, |
531 | &disconnect_notify, &inbound_notify, GNUNET_YES, | 531 | &disconnect_notify, &inbound_notify, GNUNET_YES, |
532 | &outbound_notify, GNUNET_YES, handlers); | 532 | &outbound_notify, GNUNET_YES, handlers); |
533 | } | 533 | } |
@@ -629,7 +629,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
629 | ¤t_quota_p2_out)); | 629 | ¤t_quota_p2_out)); |
630 | 630 | ||
631 | p1.ch = | 631 | p1.ch = |
632 | GNUNET_CORE_connect (p1.cfg, 1, &p1, &init_notify, &connect_notify, | 632 | GNUNET_CORE_connect (p1.cfg, &p1, &init_notify, &connect_notify, |
633 | &disconnect_notify, &inbound_notify, GNUNET_YES, | 633 | &disconnect_notify, &inbound_notify, GNUNET_YES, |
634 | &outbound_notify, GNUNET_YES, handlers); | 634 | &outbound_notify, GNUNET_YES, handlers); |
635 | } | 635 | } |
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 083b49923..dc91ac32d 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c | |||
@@ -1980,7 +1980,7 @@ GDS_NEIGHBOURS_init () | |||
1980 | bucket_size = (unsigned int) temp_config_num; | 1980 | bucket_size = (unsigned int) temp_config_num; |
1981 | atsAPI = GNUNET_ATS_performance_init (GDS_cfg, NULL, NULL); | 1981 | atsAPI = GNUNET_ATS_performance_init (GDS_cfg, NULL, NULL); |
1982 | coreAPI = | 1982 | coreAPI = |
1983 | GNUNET_CORE_connect (GDS_cfg, 1, NULL, &core_init, &handle_core_connect, | 1983 | GNUNET_CORE_connect (GDS_cfg, NULL, &core_init, &handle_core_connect, |
1984 | &handle_core_disconnect, NULL, GNUNET_NO, NULL, | 1984 | &handle_core_disconnect, NULL, GNUNET_NO, NULL, |
1985 | GNUNET_NO, core_handlers); | 1985 | GNUNET_NO, core_handlers); |
1986 | if (coreAPI == NULL) | 1986 | if (coreAPI == NULL) |
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index 956595f43..6ee95c051 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c | |||
@@ -3295,7 +3295,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
3295 | GNUNET_CONTAINER_multihashmap_create (max_table_size * 3); | 3295 | GNUNET_CONTAINER_multihashmap_create (max_table_size * 3); |
3296 | 3296 | ||
3297 | GNUNET_SERVER_add_handlers (server, plugin_handlers); | 3297 | GNUNET_SERVER_add_handlers (server, plugin_handlers); |
3298 | coreAPI = GNUNET_CORE_connect (cfg, 1, NULL, /* FIXME: anything we want to pass around? */ | 3298 | coreAPI = GNUNET_CORE_connect (cfg, NULL, /* FIXME: anything we want to pass around? */ |
3299 | &core_init, &handle_core_connect, | 3299 | &core_init, &handle_core_connect, |
3300 | &handle_core_disconnect, NULL, GNUNET_NO, NULL, | 3300 | &handle_core_disconnect, NULL, GNUNET_NO, NULL, |
3301 | GNUNET_NO, core_handlers); | 3301 | GNUNET_NO, core_handlers); |
diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c index 6165a9db2..b24bfbf31 100644 --- a/src/dv/test_transport_api_dv.c +++ b/src/dv/test_transport_api_dv.c | |||
@@ -601,7 +601,7 @@ connect_notify_peer1 (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
601 | * Connect to the receiving peer | 601 | * Connect to the receiving peer |
602 | */ | 602 | */ |
603 | pos->peer2handle = | 603 | pos->peer2handle = |
604 | GNUNET_CORE_connect (pos->peer2->cfg, 1, pos, &init_notify_peer2, | 604 | GNUNET_CORE_connect (pos->peer2->cfg, pos, &init_notify_peer2, |
605 | &connect_notify_peer2, NULL, NULL, GNUNET_YES, | 605 | &connect_notify_peer2, NULL, NULL, GNUNET_YES, |
606 | NULL, GNUNET_YES, handlers); | 606 | NULL, GNUNET_YES, handlers); |
607 | } | 607 | } |
@@ -651,7 +651,7 @@ send_test_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
651 | * Connect to the sending peer | 651 | * Connect to the sending peer |
652 | */ | 652 | */ |
653 | pos->peer1handle = | 653 | pos->peer1handle = |
654 | GNUNET_CORE_connect (pos->peer1->cfg, 1, pos, &init_notify_peer1, | 654 | GNUNET_CORE_connect (pos->peer1->cfg, pos, &init_notify_peer1, |
655 | &connect_notify_peer1, NULL, NULL, GNUNET_NO, NULL, | 655 | &connect_notify_peer1, NULL, NULL, GNUNET_NO, NULL, |
656 | GNUNET_NO, no_handlers); | 656 | GNUNET_NO, no_handlers); |
657 | 657 | ||
@@ -944,7 +944,7 @@ peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id, | |||
944 | 944 | ||
945 | new_peer = GNUNET_malloc (sizeof (struct PeerContext)); | 945 | new_peer = GNUNET_malloc (sizeof (struct PeerContext)); |
946 | new_peer->peer_handle = | 946 | new_peer->peer_handle = |
947 | GNUNET_CORE_connect (cfg, 1, d, NULL, &all_connect_handler, NULL, NULL, | 947 | GNUNET_CORE_connect (cfg, d, NULL, &all_connect_handler, NULL, NULL, |
948 | GNUNET_NO, NULL, GNUNET_NO, no_handlers); | 948 | GNUNET_NO, NULL, GNUNET_NO, no_handlers); |
949 | new_peer->daemon = d; | 949 | new_peer->daemon = d; |
950 | new_peer->next = all_peers; | 950 | new_peer->next = all_peers; |
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 06ac91c73..94e8e6b23 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -572,7 +572,7 @@ main_init (struct GNUNET_SERVER_Handle *server, | |||
572 | }; | 572 | }; |
573 | 573 | ||
574 | GSF_core = | 574 | GSF_core = |
575 | GNUNET_CORE_connect (GSF_cfg, 1, NULL, &peer_init_handler, | 575 | GNUNET_CORE_connect (GSF_cfg, NULL, &peer_init_handler, |
576 | &peer_connect_handler, &GSF_peer_disconnect_handler_, | 576 | &peer_connect_handler, &GSF_peer_disconnect_handler_, |
577 | NULL, GNUNET_NO, NULL, GNUNET_NO, p2p_handlers); | 577 | NULL, GNUNET_NO, NULL, GNUNET_NO, p2p_handlers); |
578 | if (NULL == GSF_core) | 578 | if (NULL == GSF_core) |
diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index 0eedb56b1..8b7bf3a3e 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c | |||
@@ -270,7 +270,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
270 | stats = GNUNET_STATISTICS_create ("hostlist", cfg); | 270 | stats = GNUNET_STATISTICS_create ("hostlist", cfg); |
271 | 271 | ||
272 | core = | 272 | core = |
273 | GNUNET_CORE_connect (cfg, 1, NULL, &core_init, &connect_handler, | 273 | GNUNET_CORE_connect (cfg, NULL, &core_init, &connect_handler, |
274 | &disconnect_handler, NULL, GNUNET_NO, NULL, | 274 | &disconnect_handler, NULL, GNUNET_NO, NULL, |
275 | GNUNET_NO, | 275 | GNUNET_NO, |
276 | learning ? learn_handlers : no_learn_handlers); | 276 | learning ? learn_handlers : no_learn_handlers); |
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c index 08ab0dedb..b7d96687c 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c | |||
@@ -411,7 +411,7 @@ setup_learn_peer (struct PeerContext *p, const char *cfgname) | |||
411 | GNUNET_free (filename); | 411 | GNUNET_free (filename); |
412 | } | 412 | } |
413 | p->core = | 413 | p->core = |
414 | GNUNET_CORE_connect (p->cfg, 1, NULL, NULL, NULL, NULL, NULL, GNUNET_NO, | 414 | GNUNET_CORE_connect (p->cfg, NULL, NULL, NULL, NULL, NULL, GNUNET_NO, |
415 | NULL, GNUNET_NO, learn_handlers); | 415 | NULL, GNUNET_NO, learn_handlers); |
416 | GNUNET_assert (NULL != p->core); | 416 | GNUNET_assert (NULL != p->core); |
417 | p->stats = GNUNET_STATISTICS_create ("hostlist", p->cfg); | 417 | p->stats = GNUNET_STATISTICS_create ("hostlist", p->cfg); |
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index cb48f4182..c648c3ce0 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h | |||
@@ -42,7 +42,7 @@ extern "C" | |||
42 | /** | 42 | /** |
43 | * Version number of GNUnet-core API. | 43 | * Version number of GNUnet-core API. |
44 | */ | 44 | */ |
45 | #define GNUNET_CORE_VERSION 0x00000000 | 45 | #define GNUNET_CORE_VERSION 0x00000001 |
46 | 46 | ||
47 | 47 | ||
48 | /** | 48 | /** |
@@ -148,14 +148,13 @@ typedef void (*GNUNET_CORE_StartupCallback) (void *cls, | |||
148 | * (or fail) asynchronously. This function primarily causes the given | 148 | * (or fail) asynchronously. This function primarily causes the given |
149 | * callback notification functions to be invoked whenever the | 149 | * callback notification functions to be invoked whenever the |
150 | * specified event happens. The maximum number of queued | 150 | * specified event happens. The maximum number of queued |
151 | * notifications (queue length) is per client but the queue is shared | 151 | * notifications (queue length) is per client; the queue is shared |
152 | * across all types of notifications. So a slow client that registers | 152 | * across all types of notifications. So a slow client that registers |
153 | * for 'outbound_notify' also risks missing 'inbound_notify' messages. | 153 | * for 'outbound_notify' also risks missing 'inbound_notify' messages. |
154 | * Certain events (such as connect/disconnect notifications) are not | 154 | * Certain events (such as connect/disconnect notifications) are not |
155 | * subject to queue size limitations. | 155 | * subject to queue size limitations. |
156 | * | 156 | * |
157 | * @param cfg configuration to use | 157 | * @param cfg configuration to use |
158 | * @param queue_size size of the per-peer message queue | ||
159 | * @param cls closure for the various callbacks that follow (including handlers in the handlers array) | 158 | * @param cls closure for the various callbacks that follow (including handlers in the handlers array) |
160 | * @param init callback to call once we have successfully | 159 | * @param init callback to call once we have successfully |
161 | * connected to the core service | 160 | * connected to the core service |
@@ -190,7 +189,7 @@ typedef void (*GNUNET_CORE_StartupCallback) (void *cls, | |||
190 | */ | 189 | */ |
191 | struct GNUNET_CORE_Handle * | 190 | struct GNUNET_CORE_Handle * |
192 | GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 191 | GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
193 | unsigned int queue_size, void *cls, | 192 | void *cls, |
194 | GNUNET_CORE_StartupCallback init, | 193 | GNUNET_CORE_StartupCallback init, |
195 | GNUNET_CORE_ConnectEventHandler connects, | 194 | GNUNET_CORE_ConnectEventHandler connects, |
196 | GNUNET_CORE_DisconnectEventHandler disconnects, | 195 | GNUNET_CORE_DisconnectEventHandler disconnects, |
@@ -220,10 +219,13 @@ struct GNUNET_CORE_TransmitHandle; | |||
220 | 219 | ||
221 | /** | 220 | /** |
222 | * Ask the core to call "notify" once it is ready to transmit the | 221 | * Ask the core to call "notify" once it is ready to transmit the |
223 | * given number of bytes to the specified "target". Must only be | 222 | * given number of bytes to the specified "target". Must only be |
224 | * called after a connection to the respective peer has been | 223 | * called after a connection to the respective peer has been |
225 | * established (and the client has been informed about this). | 224 | * established (and the client has been informed about this). You may |
226 | * | 225 | * have one request of this type pending for each connected peer at |
226 | * any time. If a peer disconnects, the application MUST call | ||
227 | * "GNUNET_CORE_notify_transmit_ready_cancel" on the respective | ||
228 | * transmission request, if one such request is pending. | ||
227 | * | 229 | * |
228 | * @param handle connection to core service | 230 | * @param handle connection to core service |
229 | * @param cork is corking allowed for this transmission? | 231 | * @param cork is corking allowed for this transmission? |
@@ -232,18 +234,13 @@ struct GNUNET_CORE_TransmitHandle; | |||
232 | * @param target who should receive the message, never NULL (can be this peer's identity for loopback) | 234 | * @param target who should receive the message, never NULL (can be this peer's identity for loopback) |
233 | * @param notify_size how many bytes of buffer space does notify want? | 235 | * @param notify_size how many bytes of buffer space does notify want? |
234 | * @param notify function to call when buffer space is available; | 236 | * @param notify function to call when buffer space is available; |
235 | * will be called with NULL on timeout or if the overall queue | 237 | * will be called with NULL on timeout; clients MUST cancel |
236 | * for this peer is larger than queue_size and this is currently | ||
237 | * the message with the lowest priority; will also be called | ||
238 | * with 'NULL' buf if the peer disconnects; since the disconnect | ||
239 | * signal will be emmitted even later, clients MUST cancel | ||
240 | * all pending transmission requests DURING the disconnect | 238 | * all pending transmission requests DURING the disconnect |
241 | * handler (unless they ensure that 'notify' never calls | 239 | * handler |
242 | * 'GNUNET_CORE_notify_transmit_ready'). | ||
243 | * @param notify_cls closure for notify | 240 | * @param notify_cls closure for notify |
244 | * @return non-NULL if the notify callback was queued, | 241 | * @return non-NULL if the notify callback was queued, |
245 | * NULL if we can not even queue the request (insufficient | 242 | * NULL if we can not even queue the request (request already pending); |
246 | * memory); if NULL is returned, "notify" will NOT be called. | 243 | * if NULL is returned, "notify" will NOT be called. |
247 | */ | 244 | */ |
248 | struct GNUNET_CORE_TransmitHandle * | 245 | struct GNUNET_CORE_TransmitHandle * |
249 | GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork, | 246 | GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork, |
diff --git a/src/integration-tests/connection_watchdog.c b/src/integration-tests/connection_watchdog.c index ac19338cf..a06b5a763 100644 --- a/src/integration-tests/connection_watchdog.c +++ b/src/integration-tests/connection_watchdog.c | |||
@@ -1060,7 +1060,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
1060 | &transport_notify_disconnect_cb); | 1060 | &transport_notify_disconnect_cb); |
1061 | GNUNET_assert (th != NULL); | 1061 | GNUNET_assert (th != NULL); |
1062 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connected to transport service\n"); | 1062 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connected to transport service\n"); |
1063 | ch = GNUNET_CORE_connect (cfg, 1, NULL, | 1063 | ch = GNUNET_CORE_connect (cfg, NULL, |
1064 | &core_init_cb, | 1064 | &core_init_cb, |
1065 | &core_connect_cb, | 1065 | &core_connect_cb, |
1066 | &core_disconnect_cb, | 1066 | &core_disconnect_cb, |
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 36c6115a1..0882dc44e 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -4757,7 +4757,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
4757 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting to run\n"); | 4757 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting to run\n"); |
4758 | server_handle = server; | 4758 | server_handle = server; |
4759 | core_handle = GNUNET_CORE_connect (c, /* Main configuration */ | 4759 | core_handle = GNUNET_CORE_connect (c, /* Main configuration */ |
4760 | CORE_QUEUE_SIZE, /* queue size */ | ||
4761 | NULL, /* Closure passed to MESH functions */ | 4760 | NULL, /* Closure passed to MESH functions */ |
4762 | &core_init, /* Call core_init once connected */ | 4761 | &core_init, /* Call core_init once connected */ |
4763 | &core_connect, /* Handle connects */ | 4762 | &core_connect, /* Handle connects */ |
diff --git a/src/mesh/gnunet-service-mesh_new.c b/src/mesh/gnunet-service-mesh_new.c index 65f3ee240..992ceea5a 100644 --- a/src/mesh/gnunet-service-mesh_new.c +++ b/src/mesh/gnunet-service-mesh_new.c | |||
@@ -4744,7 +4744,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
4744 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting to run\n"); | 4744 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting to run\n"); |
4745 | server_handle = server; | 4745 | server_handle = server; |
4746 | core_handle = GNUNET_CORE_connect (c, /* Main configuration */ | 4746 | core_handle = GNUNET_CORE_connect (c, /* Main configuration */ |
4747 | 1, /* queue size */ | ||
4748 | NULL, /* Closure passed to MESH functions */ | 4747 | NULL, /* Closure passed to MESH functions */ |
4749 | &core_init, /* Call core_init once connected */ | 4748 | &core_init, /* Call core_init once connected */ |
4750 | &core_connect, /* Handle connects */ | 4749 | &core_connect, /* Handle connects */ |
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index 9c31ab8e2..af8c7c081 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c | |||
@@ -1441,7 +1441,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1441 | nc = GNUNET_SERVER_notification_context_create (server, 1); | 1441 | nc = GNUNET_SERVER_notification_context_create (server, 1); |
1442 | /* Connect to core service and register core handlers */ | 1442 | /* Connect to core service and register core handlers */ |
1443 | coreAPI = GNUNET_CORE_connect (cfg, /* Main configuration */ | 1443 | coreAPI = GNUNET_CORE_connect (cfg, /* Main configuration */ |
1444 | 1, NULL, /* Closure passed to functions */ | 1444 | NULL, /* Closure passed to functions */ |
1445 | &core_init, /* Call core_init once connected */ | 1445 | &core_init, /* Call core_init once connected */ |
1446 | &handle_core_connect, /* Handle connects */ | 1446 | &handle_core_connect, /* Handle connects */ |
1447 | &handle_core_disconnect, /* Handle disconnects */ | 1447 | &handle_core_disconnect, /* Handle disconnects */ |
diff --git a/src/testing/test_testing_large_topology.c b/src/testing/test_testing_large_topology.c index d126ab940..cd80db195 100644 --- a/src/testing/test_testing_large_topology.c +++ b/src/testing/test_testing_large_topology.c | |||
@@ -564,7 +564,7 @@ init_notify_peer1 (void *cls, struct GNUNET_CORE_Handle *server, | |||
564 | * Connect to the receiving peer | 564 | * Connect to the receiving peer |
565 | */ | 565 | */ |
566 | pos->peer2handle = | 566 | pos->peer2handle = |
567 | GNUNET_CORE_connect (pos->peer2->cfg, 1, pos, &init_notify_peer2, NULL, | 567 | GNUNET_CORE_connect (pos->peer2->cfg, pos, &init_notify_peer2, NULL, |
568 | NULL, NULL, NULL, GNUNET_YES, NULL, GNUNET_YES, | 568 | NULL, NULL, NULL, GNUNET_YES, NULL, GNUNET_YES, |
569 | handlers); | 569 | handlers); |
570 | 570 | ||
@@ -603,7 +603,7 @@ send_test_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
603 | * Connect to the sending peer | 603 | * Connect to the sending peer |
604 | */ | 604 | */ |
605 | pos->peer1handle = | 605 | pos->peer1handle = |
606 | GNUNET_CORE_connect (pos->peer1->cfg, 1, pos, &init_notify_peer1, | 606 | GNUNET_CORE_connect (pos->peer1->cfg, pos, &init_notify_peer1, |
607 | &connect_notify_peers, NULL, NULL, NULL, GNUNET_NO, | 607 | &connect_notify_peers, NULL, NULL, NULL, GNUNET_NO, |
608 | NULL, GNUNET_NO, no_handlers); | 608 | NULL, GNUNET_NO, no_handlers); |
609 | 609 | ||
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c index b21654483..94cbc0df6 100644 --- a/src/testing/test_testing_topology.c +++ b/src/testing/test_testing_topology.c | |||
@@ -585,7 +585,7 @@ init_notify_peer1 (void *cls, struct GNUNET_CORE_Handle *server, | |||
585 | * Connect to the receiving peer | 585 | * Connect to the receiving peer |
586 | */ | 586 | */ |
587 | pos->peer2handle = | 587 | pos->peer2handle = |
588 | GNUNET_CORE_connect (pos->peer2->cfg, 1, pos, &init_notify_peer2, NULL, | 588 | GNUNET_CORE_connect (pos->peer2->cfg, pos, &init_notify_peer2, NULL, |
589 | NULL, NULL, GNUNET_YES, NULL, GNUNET_YES, handlers); | 589 | NULL, NULL, GNUNET_YES, NULL, GNUNET_YES, handlers); |
590 | 590 | ||
591 | } | 591 | } |
@@ -623,7 +623,7 @@ send_test_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
623 | * Connect to the sending peer | 623 | * Connect to the sending peer |
624 | */ | 624 | */ |
625 | pos->peer1handle = | 625 | pos->peer1handle = |
626 | GNUNET_CORE_connect (pos->peer1->cfg, 1, pos, &init_notify_peer1, | 626 | GNUNET_CORE_connect (pos->peer1->cfg, pos, &init_notify_peer1, |
627 | &connect_notify_peers, NULL, NULL, GNUNET_NO, NULL, | 627 | &connect_notify_peers, NULL, NULL, GNUNET_NO, NULL, |
628 | GNUNET_NO, no_handlers); | 628 | GNUNET_NO, no_handlers); |
629 | 629 | ||
diff --git a/src/testing/testing.c b/src/testing/testing.c index 31bea068c..a80ad25cf 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -1911,7 +1911,7 @@ reattempt_daemons_connect (void *cls, | |||
1911 | GNUNET_assert (ctx->d1core == NULL); | 1911 | GNUNET_assert (ctx->d1core == NULL); |
1912 | ctx->d1core_ready = GNUNET_NO; | 1912 | ctx->d1core_ready = GNUNET_NO; |
1913 | ctx->d1core = | 1913 | ctx->d1core = |
1914 | GNUNET_CORE_connect (ctx->d1->cfg, 1, ctx, &core_init_notify, | 1914 | GNUNET_CORE_connect (ctx->d1->cfg, ctx, &core_init_notify, |
1915 | &connect_notify, NULL, NULL, GNUNET_NO, NULL, | 1915 | &connect_notify, NULL, NULL, GNUNET_NO, NULL, |
1916 | GNUNET_NO, no_handlers); | 1916 | GNUNET_NO, no_handlers); |
1917 | if (ctx->d1core == NULL) | 1917 | if (ctx->d1core == NULL) |
@@ -2055,7 +2055,7 @@ core_initial_iteration (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2055 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2055 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2056 | "Peers are NOT connected, connecting to core!\n"); | 2056 | "Peers are NOT connected, connecting to core!\n"); |
2057 | ctx->d1core = | 2057 | ctx->d1core = |
2058 | GNUNET_CORE_connect (ctx->d1->cfg, 1, ctx, &core_init_notify, | 2058 | GNUNET_CORE_connect (ctx->d1->cfg, ctx, &core_init_notify, |
2059 | &connect_notify, NULL, NULL, GNUNET_NO, NULL, | 2059 | &connect_notify, NULL, NULL, GNUNET_NO, NULL, |
2060 | GNUNET_NO, no_handlers); | 2060 | GNUNET_NO, no_handlers); |
2061 | } | 2061 | } |
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index 382c9f3d2..57da127fd 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c | |||
@@ -1319,7 +1319,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
1319 | blacklist = GNUNET_TRANSPORT_blacklist (cfg, &blacklist_check, NULL); | 1319 | blacklist = GNUNET_TRANSPORT_blacklist (cfg, &blacklist_check, NULL); |
1320 | transport = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, NULL, NULL, NULL); | 1320 | transport = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, NULL, NULL, NULL); |
1321 | handle = | 1321 | handle = |
1322 | GNUNET_CORE_connect (cfg, 1, NULL, &core_init, &connect_notify, | 1322 | GNUNET_CORE_connect (cfg, NULL, &core_init, &connect_notify, |
1323 | &disconnect_notify, NULL, GNUNET_NO, NULL, GNUNET_NO, | 1323 | &disconnect_notify, NULL, GNUNET_NO, NULL, GNUNET_NO, |
1324 | handlers); | 1324 | handlers); |
1325 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleaning_task, | 1325 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleaning_task, |