X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Ffs%2Fgnunet-service-fs.c;h=2ba96334c13c34101d25f2632f5996395cf16200;hb=29e6158507a0758192075ac6ece7ba8e75ddc49a;hp=b48531d16f25bdac6210f3f4d5300eb675e3f356;hpb=c345383f56aa7d7da19fcd129ab0974c16ed92bc;p=oweals%2Fgnunet.git diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index b48531d16..2ba96334c 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors) + Copyright (C) 2009-2014 GNUnet e.V. GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -14,8 +14,8 @@ You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /** @@ -43,8 +43,9 @@ #include "gnunet-service-fs_pr.h" #include "gnunet-service-fs_push.h" #include "gnunet-service-fs_put.h" -#include "gnunet-service-fs_stream.h" +#include "gnunet-service-fs_cadet.h" #include "fs.h" +#include "fs_api.h" /** * Size for the hash map for DHT requests from the FS @@ -100,6 +101,12 @@ struct GNUNET_LOAD_Value *GSF_rt_entry_lifetime; */ struct GNUNET_TIME_Relative GSF_avg_latency = { 500 }; +/** + * Handle to ATS service. + */ +struct GNUNET_ATS_PerformanceHandle *GSF_ats; + + /** * Typical priorities we're seeing from other peers right now. Since * most priorities will be zero, this value is the weighted average of @@ -152,10 +159,15 @@ int GSF_enable_randomized_delays; */ static struct GNUNET_CONFIGURATION_Handle *block_cfg; +/** + * Private key of this peer. Used to sign LOC URI requests. + */ +static struct GNUNET_CRYPTO_EddsaPrivateKey *pk; + /** * ID of our task that we use to age the cover counters. */ -static GNUNET_SCHEDULER_TaskIdentifier cover_age_task; +static struct GNUNET_SCHEDULER_Task * cover_age_task; /** * Datastore 'GET' load tracking. @@ -167,14 +179,14 @@ static struct GNUNET_LOAD_Value *datastore_get_load; */ static struct GNUNET_PeerIdentity my_id; + /** * Task that periodically ages our cover traffic statistics. * * @param cls unused closure - * @param tc task context */ static void -age_cover_counters (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +age_cover_counters (void *cls) { GSF_cover_content_count = (GSF_cover_content_count * 15) / 16; GSF_cover_query_count = (GSF_cover_query_count * 15) / 16; @@ -196,7 +208,7 @@ GSF_update_datastore_delay_ (struct GNUNET_TIME_Absolute start) struct GNUNET_TIME_Relative delay; delay = GNUNET_TIME_absolute_get_duration (start); - GNUNET_LOAD_update (datastore_get_load, delay.rel_value); + GNUNET_LOAD_update (datastore_get_load, delay.rel_value_us); } @@ -205,9 +217,10 @@ GSF_update_datastore_delay_ (struct GNUNET_TIME_Absolute start) * to even consider processing the query at * all. * - * @return GNUNET_YES if the load is too high to do anything (load high) - * GNUNET_NO to process normally (load normal) - * GNUNET_SYSERR to process for free (load low) + * @param priority priority of the request (used as a reference point to compare with the load) + * @return #GNUNET_YES if the load is too high to do anything (load high) + * #GNUNET_NO to process normally (load normal) + * #GNUNET_SYSERR to process for free (load low) */ int GSF_test_get_load_too_high_ (uint32_t priority) @@ -227,29 +240,38 @@ GSF_test_get_load_too_high_ (uint32_t priority) * We've received peer performance information. Update * our running average for the P2P latency. * - * @param atsi performance information - * @param atsi_count number of 'atsi' records + * @param cls closure + * @param address the address + * @param active is this address in active use + * @param bandwidth_out assigned outbound bandwidth for the connection + * @param bandwidth_in assigned inbound bandwidth for the connection + * @param prop performance data for the address (as far as known) */ static void -update_latencies (const struct GNUNET_ATS_Information *atsi, - unsigned int atsi_count) +update_latencies (void *cls, + const struct GNUNET_HELLO_Address *address, + int active, + struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, + struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, + const struct GNUNET_ATS_Properties *prop) { - unsigned int i; - - for (i = 0; i < atsi_count; i++) + if (NULL == address) { - if (ntohl (atsi[i].type) == GNUNET_ATS_QUALITY_NET_DELAY) - { - GSF_avg_latency.rel_value = - (GSF_avg_latency.rel_value * 31 + - GNUNET_MIN (5000, ntohl (atsi[i].value))) / 32; - GNUNET_STATISTICS_set (GSF_stats, - gettext_noop - ("# running average P2P latency (ms)"), - GSF_avg_latency.rel_value, GNUNET_NO); - break; - } + /* ATS service temporarily disconnected */ + return; } + + if (GNUNET_YES != active) + return; + GSF_update_peer_latency_ (&address->peer, + prop->delay); + GSF_avg_latency.rel_value_us = + (GSF_avg_latency.rel_value_us * 31 + + GNUNET_MIN (5000, prop->delay.rel_value_us)) / 32; + GNUNET_STATISTICS_set (GSF_stats, + gettext_noop ("# running average P2P latency (ms)"), + GSF_avg_latency.rel_value_us / 1000LL, + GNUNET_NO); } @@ -260,19 +282,19 @@ update_latencies (const struct GNUNET_ATS_Information *atsi, * @param other the other peer involved (sender or receiver, NULL * for loopback messages where we are both sender and receiver) * @param message the actual message - * @param atsi performance information - * @param atsi_count number of records in 'atsi' - * @return GNUNET_OK to keep the connection open, - * GNUNET_SYSERR to close it (signal serious error) + * @return #GNUNET_OK to keep the connection open, + * #GNUNET_SYSERR to close it (signal serious error) */ static int -handle_p2p_put (void *cls, const struct GNUNET_PeerIdentity *other, - const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi, - unsigned int atsi_count) +handle_p2p_put (void *cls, + const struct GNUNET_PeerIdentity *other, + const struct GNUNET_MessageHeader *message) { struct GSF_ConnectedPeer *cp; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Received P2P PUT from %s\n", + GNUNET_i2s (other)); cp = GSF_peer_get_ (other); if (NULL == cp) { @@ -280,7 +302,6 @@ handle_p2p_put (void *cls, const struct GNUNET_PeerIdentity *other, return GNUNET_OK; } GSF_cover_content_count++; - update_latencies (atsi, atsi_count); return GSF_handle_p2p_content_ (cp, message); } @@ -289,7 +310,7 @@ handle_p2p_put (void *cls, const struct GNUNET_PeerIdentity *other, * We have a new request, consider forwarding it to the given * peer. * - * @param cls the 'struct GSF_PendingRequest' + * @param cls the `struct GSF_PendingRequest` * @param peer identity of the peer * @param cp handle to the connected peer record * @param ppd peer performance data @@ -326,12 +347,17 @@ consider_request_for_forwarding (void *cls, * @param result final datastore lookup result */ static void -consider_forwarding (void *cls, struct GSF_PendingRequest *pr, +consider_forwarding (void *cls, + struct GSF_PendingRequest *pr, enum GNUNET_BLOCK_EvaluationResult result) { if (GNUNET_BLOCK_EVALUATION_OK_LAST == result) return; /* we're done... */ - GSF_iterate_connected_peers_ (&consider_request_for_forwarding, pr); + if (GNUNET_YES != + GSF_pending_request_test_active_ (pr)) + return; /* request is not actually active, skip! */ + GSF_iterate_connected_peers_ (&consider_request_for_forwarding, + pr); } @@ -342,25 +368,24 @@ consider_forwarding (void *cls, struct GSF_PendingRequest *pr, * @param other the other peer involved (sender or receiver, NULL * for loopback messages where we are both sender and receiver) * @param message the actual message - * @param atsi performance information - * @param atsi_count number of records in 'atsi' - * @return GNUNET_OK to keep the connection open, - * GNUNET_SYSERR to close it (signal serious error) + * @return #GNUNET_OK to keep the connection open, + * #GNUNET_SYSERR to close it (signal serious error) */ static int -handle_p2p_get (void *cls, const struct GNUNET_PeerIdentity *other, - const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi, - unsigned int atsi_count) +handle_p2p_get (void *cls, + const struct GNUNET_PeerIdentity *other, + const struct GNUNET_MessageHeader *message) { struct GSF_PendingRequest *pr; - pr = GSF_handle_p2p_query_ (other, message); + pr = GSF_handle_p2p_query_ (other, + message); if (NULL == pr) - return GNUNET_SYSERR; + return GNUNET_OK; /* exists, identical to existing request, or malformed */ GSF_pending_request_get_data_ (pr)->has_started = GNUNET_YES; - GSF_local_lookup_ (pr, &consider_forwarding, NULL); - update_latencies (atsi, atsi_count); + GSF_local_lookup_ (pr, + &consider_forwarding, + NULL); return GNUNET_OK; } @@ -371,42 +396,41 @@ handle_p2p_get (void *cls, const struct GNUNET_PeerIdentity *other, * result status). Also signal that we can now * receive more request information from the client. * - * @param cls the client doing the request ('struct GNUNET_SERVER_Client') + * @param cls the client doing the request (`struct GNUNET_SERVER_Client`) * @param pr the pending request we were processing * @param result final datastore lookup result */ static void -start_p2p_processing (void *cls, struct GSF_PendingRequest *pr, +start_p2p_processing (void *cls, + struct GSF_PendingRequest *pr, enum GNUNET_BLOCK_EvaluationResult result) { struct GNUNET_SERVER_Client *client = cls; struct GSF_PendingRequestData *prd; + GNUNET_SERVER_receive_done (client, + GNUNET_OK); + if (GNUNET_BLOCK_EVALUATION_OK_LAST == result) + return; /* we're done, 'pr' was already destroyed... */ prd = GSF_pending_request_get_data_ (pr); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished database lookup for local request `%s' with result %d\n", GNUNET_h2s (&prd->query), result); - GNUNET_SERVER_receive_done (client, GNUNET_OK); - if (GNUNET_BLOCK_EVALUATION_OK_LAST == result) - return; /* we're done, 'pr' was already destroyed... */ - if (0 != (GSF_PRO_LOCAL_ONLY & prd->options)) - { - GSF_pending_request_cancel_ (pr, GNUNET_YES); - return; - } if (0 == prd->anonymity_level) { switch (prd->type) { case GNUNET_BLOCK_TYPE_FS_DBLOCK: case GNUNET_BLOCK_TYPE_FS_IBLOCK: - /* the above block types MAY be available via 'stream' */ - GSF_stream_lookup_ (pr); - break; - case GNUNET_BLOCK_TYPE_FS_KBLOCK: - case GNUNET_BLOCK_TYPE_FS_SBLOCK: - case GNUNET_BLOCK_TYPE_FS_NBLOCK: + /* the above block types MAY be available via 'cadet' */ + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Considering cadet-based download for block\n"); + GSF_cadet_lookup_ (pr); + break; + case GNUNET_BLOCK_TYPE_FS_UBLOCK: /* the above block types are in the DHT */ + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Considering DHT-based search for block\n"); GSF_dht_lookup_ (pr); break; default: @@ -419,32 +443,40 @@ start_p2p_processing (void *cls, struct GSF_PendingRequest *pr, /** - * Handle START_SEARCH-message (search request from client). + * Handle #GNUNET_MESSAGE_TYPE_FS_START_SEARCH-message (search request + * from client). * * @param cls closure * @param client identification of the client * @param message the actual message */ static void -handle_start_search (void *cls, struct GNUNET_SERVER_Client *client, +handle_start_search (void *cls, + struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { struct GSF_PendingRequest *pr; int ret; pr = NULL; - ret = GSF_local_client_start_search_handler_ (client, message, &pr); + ret = GSF_local_client_start_search_handler_ (client, + message, + &pr); switch (ret) { case GNUNET_SYSERR: - GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); + GNUNET_SERVER_receive_done (client, + GNUNET_SYSERR); break; case GNUNET_NO: - GNUNET_SERVER_receive_done (client, GNUNET_OK); + GNUNET_SERVER_receive_done (client, + GNUNET_OK); break; case GNUNET_YES: GSF_pending_request_get_data_ (pr)->has_started = GNUNET_YES; - GSF_local_lookup_ (pr, &start_p2p_processing, client); + GSF_local_lookup_ (pr, + &start_p2p_processing, + client); break; default: GNUNET_assert (0); @@ -452,21 +484,67 @@ handle_start_search (void *cls, struct GNUNET_SERVER_Client *client, } +/** + * Handle request to sign a LOC URI (from client). + * + * @param cls closure (NULL) + * @param client identification of the client + * @param message the actual message + */ +static void +handle_loc_sign (void *cls, + struct GNUNET_SERVER_Client *client, + const struct GNUNET_MessageHeader *message) +{ + const struct RequestLocSignatureMessage *msg; + struct GNUNET_FS_Uri base; + struct GNUNET_FS_Uri *loc; + struct ResponseLocSignatureMessage resp; + struct GSF_LocalClient *lc; + + msg = (const struct RequestLocSignatureMessage *) message; + GNUNET_break (GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT == + ntohl (msg->purpose)); + base.type = GNUNET_FS_URI_CHK; + base.data.chk.chk = msg->chk; + base.data.chk.file_length = GNUNET_ntohll (msg->file_length); + loc = GNUNET_FS_uri_loc_create (&base, + pk, + GNUNET_TIME_absolute_ntoh (msg->expiration_time)); + resp.header.size = htons (sizeof (struct ResponseLocSignatureMessage)); + resp.header.type = htons (GNUNET_MESSAGE_TYPE_FS_REQUEST_LOC_SIGNATURE); + resp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT); + resp.expiration_time = GNUNET_TIME_absolute_hton (loc->data.loc.expirationTime); + resp.signature = loc->data.loc.contentSignature; + resp.peer = loc->data.loc.peer; + GNUNET_FS_uri_destroy (loc); + lc = GSF_local_client_lookup_ (client); + GSF_local_client_transmit_ (lc, + &resp.header); + GNUNET_SERVER_receive_done (client, GNUNET_OK); +} + + /** * Task run during shutdown. * * @param cls unused - * @param tc unused */ static void -shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { - GSF_stream_stop (); + GSF_cadet_stop_client (); + GSF_cadet_stop_server (); if (NULL != GSF_core) { GNUNET_CORE_disconnect (GSF_core); GSF_core = NULL; } + if (NULL != GSF_ats) + { + GNUNET_ATS_performance_done (GSF_ats); + GSF_ats = NULL; + } GSF_put_done_ (); GSF_push_done_ (); GSF_pending_request_done_ (); @@ -482,10 +560,10 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) block_cfg = NULL; GNUNET_STATISTICS_destroy (GSF_stats, GNUNET_NO); GSF_stats = NULL; - if (GNUNET_SCHEDULER_NO_TASK != cover_age_task) + if (NULL != cover_age_task) { GNUNET_SCHEDULER_cancel (cover_age_task); - cover_age_task = GNUNET_SCHEDULER_NO_TASK; + cover_age_task = NULL; } GNUNET_FS_indexing_done (); GNUNET_LOAD_value_free (datastore_get_load); @@ -500,23 +578,29 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * peer connects, giving us a chance to decide about submitting * the existing request to the new peer. * - * @param cls the 'struct GSF_ConnectedPeer' of the new peer + * @param cls the `struct GSF_ConnectedPeer` of the new peer * @param key query for the request * @param pr handle to the pending request - * @return GNUNET_YES to continue to iterate + * @return #GNUNET_YES to continue to iterate */ static int -consider_peer_for_forwarding (void *cls, const struct GNUNET_HashCode * key, +consider_peer_for_forwarding (void *cls, + const struct GNUNET_HashCode *key, struct GSF_PendingRequest *pr) { struct GSF_ConnectedPeer *cp = cls; struct GNUNET_PeerIdentity pid; + if (GNUNET_YES != + GSF_pending_request_test_active_ (pr)) + return GNUNET_YES; /* request is not actually active, skip! */ GSF_connected_peer_get_identity_ (cp, &pid); - if (GNUNET_YES != GSF_pending_request_test_target_ (pr, &pid)) + if (GNUNET_YES != + GSF_pending_request_test_target_ (pr, &pid)) { GNUNET_STATISTICS_update (GSF_stats, - gettext_noop ("# Loopback routes suppressed"), 1, + gettext_noop ("# Loopback routes suppressed"), + 1, GNUNET_NO); return GNUNET_YES; } @@ -525,27 +609,40 @@ consider_peer_for_forwarding (void *cls, const struct GNUNET_HashCode * key, } +/** + * Function called after the creation of a connected peer record is complete. + * + * @param cls closure (unused) + * @param cp handle to the newly created connected peer record + */ +static void +connected_peer_cb (void *cls, + struct GSF_ConnectedPeer *cp) +{ + if (NULL == cp) + return; + GSF_iterate_pending_requests_ (&consider_peer_for_forwarding, + cp); +} + + /** * Method called whenever a given peer connects. * * @param cls closure, not used * @param peer peer identity this notification is about - * @param atsi performance information - * @param atsi_count number of records in 'atsi' */ static void -peer_connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi, - unsigned int atsi_count) +peer_connect_handler (void *cls, + const struct GNUNET_PeerIdentity *peer) { - struct GSF_ConnectedPeer *cp; - - if (0 == memcmp (&my_id, peer, sizeof (struct GNUNET_PeerIdentity))) + if (0 == + GNUNET_CRYPTO_cmp_peer_identity (&my_id, + peer)) return; - cp = GSF_peer_connect_handler_ (peer, atsi, atsi_count); - if (NULL == cp) - return; - GSF_iterate_pending_requests_ (&consider_peer_for_forwarding, cp); + GSF_peer_connect_handler_ (peer, + &connected_peer_cb, + NULL); } @@ -557,14 +654,19 @@ 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; + if (0 != GNUNET_CRYPTO_cmp_peer_identity (&my_id, + my_identity)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Peer identity missmatch, refusing to start!\n"); + GNUNET_SCHEDULER_shutdown (); + } } @@ -579,42 +681,71 @@ main_init (struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c) { static const struct GNUNET_CORE_MessageHandler no_p2p_handlers[] = { - {NULL, 0, 0} + { NULL, 0, 0 } }; static const struct GNUNET_CORE_MessageHandler p2p_handlers[] = { - {&handle_p2p_get, - GNUNET_MESSAGE_TYPE_FS_GET, 0}, - {&handle_p2p_put, - GNUNET_MESSAGE_TYPE_FS_PUT, 0}, - {&GSF_handle_p2p_migration_stop_, - GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP, - sizeof (struct MigrationStopMessage)}, - {NULL, 0, 0} + { &handle_p2p_get, + GNUNET_MESSAGE_TYPE_FS_GET, 0 }, + { &handle_p2p_put, + GNUNET_MESSAGE_TYPE_FS_PUT, 0 }, + { &GSF_handle_p2p_migration_stop_, + GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP, + sizeof (struct MigrationStopMessage) }, + { NULL, 0, 0 } }; static const struct GNUNET_SERVER_MessageHandler handlers[] = { - {&GNUNET_FS_handle_index_start, NULL, - GNUNET_MESSAGE_TYPE_FS_INDEX_START, 0}, - {&GNUNET_FS_handle_index_list_get, NULL, - GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_GET, - sizeof (struct GNUNET_MessageHeader)}, - {&GNUNET_FS_handle_unindex, NULL, GNUNET_MESSAGE_TYPE_FS_UNINDEX, - sizeof (struct UnindexMessage)}, - {&handle_start_search, NULL, GNUNET_MESSAGE_TYPE_FS_START_SEARCH, - 0}, + { &GNUNET_FS_handle_index_start, NULL, + GNUNET_MESSAGE_TYPE_FS_INDEX_START, 0 }, + { &GNUNET_FS_handle_index_list_get, NULL, + GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_GET, + sizeof (struct GNUNET_MessageHeader) }, + { &GNUNET_FS_handle_unindex, NULL, + GNUNET_MESSAGE_TYPE_FS_UNINDEX, + sizeof (struct UnindexMessage) }, + { &handle_start_search, NULL, + GNUNET_MESSAGE_TYPE_FS_START_SEARCH, 0 }, + { &handle_loc_sign, NULL, + GNUNET_MESSAGE_TYPE_FS_REQUEST_LOC_SIGN, + sizeof (struct RequestLocSignatureMessage) }, {NULL, NULL, 0, 0} }; int anon_p2p_off; + char *keyfile; /* this option is really only for testcases that need to disable _anonymous_ file-sharing for some reason */ anon_p2p_off = (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (GSF_cfg, "fs", - "DISABLE_ANON_TRANSFER")); - GSF_core = - GNUNET_CORE_connect (GSF_cfg, NULL, &peer_init_handler, - &peer_connect_handler, &GSF_peer_disconnect_handler_, - NULL, GNUNET_NO, NULL, GNUNET_NO, + "DISABLE_ANON_TRANSFER")); + + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_filename (GSF_cfg, + "PEER", + "PRIVATE_KEY", + &keyfile)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("FS service is lacking HOSTKEY configuration setting. Exiting.\n")); + GNUNET_SCHEDULER_shutdown (); + return GNUNET_SYSERR; + } + pk = GNUNET_CRYPTO_eddsa_key_create_from_file (keyfile); + GNUNET_free (keyfile); + GNUNET_assert (NULL != pk); + GNUNET_CRYPTO_eddsa_key_get_public (pk, + &my_id.public_key); + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "I am peer %s\n", + GNUNET_i2s (&my_id)); + GSF_core + = GNUNET_CORE_connect (GSF_cfg, NULL, + &peer_init_handler, + &peer_connect_handler, + &GSF_peer_disconnect_handler_, + NULL, GNUNET_NO, + NULL, GNUNET_NO, (GNUNET_YES == anon_p2p_off) ? no_p2p_handlers : p2p_handlers); @@ -631,7 +762,8 @@ main_init (struct GNUNET_SERVER_Handle *server, GNUNET_SCHEDULER_add_delayed (COVER_AGE_FREQUENCY, &age_cover_counters, NULL); datastore_get_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE); - GSF_stream_start (); + GSF_cadet_start_server (); + GSF_cadet_start_client (); GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, NULL); return GNUNET_OK; @@ -672,20 +804,20 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, GSF_rt_entry_lifetime = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_FOREVER_REL); GSF_stats = GNUNET_STATISTICS_create ("fs", cfg); block_cfg = GNUNET_CONFIGURATION_create (); - GNUNET_CONFIGURATION_set_value_string (block_cfg, "block", "PLUGINS", "fs"); GSF_block_ctx = GNUNET_BLOCK_context_create (block_cfg); GNUNET_assert (NULL != GSF_block_ctx); GSF_dht = GNUNET_DHT_connect (cfg, FS_DHT_HT_SIZE); GSF_plan_init (); GSF_pending_request_init_ (); GSF_connected_peer_init_ (); + GSF_ats = GNUNET_ATS_performance_init (GSF_cfg, &update_latencies, NULL); GSF_push_init_ (); GSF_put_init_ (); if ((GNUNET_OK != GNUNET_FS_indexing_init (cfg, GSF_dsh)) || (GNUNET_OK != main_init (server, cfg))) { GNUNET_SCHEDULER_shutdown (); - shutdown_task (NULL, NULL); + shutdown_task (NULL); return; } }