From e4794e7e4bc63d2023768e3b1017f19bd0d41c5f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 18 Jun 2010 15:02:59 +0000 Subject: cleaning --- src/core/gnunet-service-core.c | 10 ++---- src/datastore/gnunet-service-datastore.c | 10 +++--- src/fs/gnunet-service-fs.c | 52 ++++++++++++------------------ src/hostlist/gnunet-daemon-hostlist.c | 4 +-- src/hostlist/hostlist-server.c | 15 ++++----- src/statistics/gnunet-service-statistics.c | 10 +++--- src/transport/gnunet-nat-client.c | 3 +- src/transport/gnunet-service-transport.c | 17 ++-------- 8 files changed, 43 insertions(+), 78 deletions(-) diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index 34b3511a8..7fcb03094 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c @@ -668,11 +668,6 @@ static struct GNUNET_PEERINFO_Handle *peerinfo; */ const struct GNUNET_CONFIGURATION_Handle *cfg; -/** - * Our server. - */ -static struct GNUNET_SERVER_Handle *server; - /** * Transport service. */ @@ -3808,13 +3803,13 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * * @param cls closure * @param s scheduler to use - * @param serv the initialized server + * @param server the initialized server * @param c configuration to use */ static void run (void *cls, struct GNUNET_SCHEDULER_Handle *s, - struct GNUNET_SERVER_Handle *serv, + struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c) { static const struct GNUNET_SERVER_MessageHandler handlers[] = { @@ -3880,7 +3875,6 @@ run (void *cls, GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key), &my_identity.hashPubKey); /* setup notification */ - server = serv; notifier = GNUNET_SERVER_notification_context_create (server, MAX_NOTIFY_QUEUE); GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL); diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c index ddab5cdf3..faae1ae99 100644 --- a/src/datastore/gnunet-service-datastore.c +++ b/src/datastore/gnunet-service-datastore.c @@ -124,11 +124,6 @@ static struct ReservationList *reservations; */ static struct GNUNET_CONTAINER_BloomFilter *filter; -/** - * Static counter to produce reservation identifiers. - */ -static int reservation_gen; - /** * How much space are we allowed to use? */ @@ -717,6 +712,11 @@ handle_reserve (void *cls, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { + /** + * Static counter to produce reservation identifiers. + */ + static int reservation_gen; + const struct ReserveMessage *msg = (const struct ReserveMessage*) message; struct ReservationList *e; unsigned long long used; diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 90d0cabaf..1c542386c 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -3414,38 +3414,6 @@ handle_start_search (void *cls, /* **************************** Startup ************************ */ - -/** - * List of handlers for P2P messages - * that we care about. - */ -static struct GNUNET_CORE_MessageHandler p2p_handlers[] = - { - { &handle_p2p_get, - GNUNET_MESSAGE_TYPE_FS_GET, 0 }, - { &handle_p2p_put, - GNUNET_MESSAGE_TYPE_FS_PUT, 0 }, - { NULL, 0, 0 } - }; - - -/** - * List of handlers for the messages understood by this - * service. - */ -static 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 }, - {NULL, NULL, 0, 0} -}; - - /** * Process fs requests. * @@ -3458,6 +3426,26 @@ main_init (struct GNUNET_SCHEDULER_Handle *s, struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c) { + 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 }, + { 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 }, + {NULL, NULL, 0, 0} + }; + sched = s; cfg = c; stats = GNUNET_STATISTICS_create (sched, "fs", cfg); diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index 300a767b5..b0599312c 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c @@ -53,12 +53,12 @@ static int provide_hostlist; /** * Handle to hostlist server's connect handler */ -static GNUNET_CORE_ConnectEventHandler server_ch = NULL; +static GNUNET_CORE_ConnectEventHandler server_ch; /** * Handle to hostlist server's disconnect handler */ -static GNUNET_CORE_DisconnectEventHandler server_dh = NULL; +static GNUNET_CORE_DisconnectEventHandler server_dh; #endif diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c index 5d8a07ef2..0726bf3e0 100644 --- a/src/hostlist/hostlist-server.c +++ b/src/hostlist/hostlist-server.c @@ -109,11 +109,6 @@ struct HostSet */ static int advertising; -/** - * How many times was the hostlist advertised? - */ -static uint64_t hostlist_adv_count; - /** * Buffer for the hostlist address */ @@ -345,6 +340,8 @@ access_handler_callback (void *cls, static size_t adv_transmit_ready ( void *cls, size_t size, void *buf) { + static uint64_t hostlist_adv_count; + size_t transmission_size; size_t uri_size; /* Including \0 termination! */ struct GNUNET_MessageHeader header; @@ -372,10 +369,10 @@ adv_transmit_ready ( void *cls, size_t size, void *buf) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " # Sent advertisement message: %u\n", hostlist_adv_count); - GNUNET_STATISTICS_set (stats, - gettext_noop("# hostlist advertisements send"), - hostlist_adv_count, - GNUNET_NO); + GNUNET_STATISTICS_update (stats, + gettext_noop("# hostlist advertisements send"), + 1, + GNUNET_NO); return transmission_size; } diff --git a/src/statistics/gnunet-service-statistics.c b/src/statistics/gnunet-service-statistics.c index efc6ce128..c34a00ddc 100644 --- a/src/statistics/gnunet-service-statistics.c +++ b/src/statistics/gnunet-service-statistics.c @@ -92,11 +92,6 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg; */ static struct StatsEntry *start; -/** - * Counter used to generate unique values. - */ -static uint32_t uidgen; - /** * Load persistent values from disk. Disk format is * exactly the same format that we also use for @@ -316,6 +311,11 @@ handle_set (void *cls, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { + /** + * Counter used to generate unique values. + */ + static uint32_t uidgen; + char *service; char *name; uint16_t msize; diff --git a/src/transport/gnunet-nat-client.c b/src/transport/gnunet-nat-client.c index 56bbf65b5..8648a4679 100644 --- a/src/transport/gnunet-nat-client.c +++ b/src/transport/gnunet-nat-client.c @@ -106,8 +106,6 @@ static int rawsock; static struct in_addr dummy; -static struct in_addr target; - static uint32_t port; static uint16_t @@ -364,6 +362,7 @@ int main (int argc, char *const *argv) { struct in_addr external; + struct in_addr target; uid_t uid; if (-1 == (rawsock = make_raw_socket())) diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 2d6a1cbb0..f3fc93a7a 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c @@ -804,12 +804,6 @@ struct CheckHelloValidatedContext */ static struct GNUNET_HELLO_Message *our_hello; -/** - * "version" of "our_hello". Used to see if a given neighbour has - * already been sent the latest version of our HELLO message. - */ -static unsigned int our_hello_version; - /** * Our public key. */ @@ -845,11 +839,6 @@ static struct TransportClient *clients; */ static struct TransportPlugin *plugins; -/** - * Our server. - */ -static struct GNUNET_SERVER_Handle *server; - /** * Handle to peerinfo service. */ @@ -1853,7 +1842,6 @@ refresh_hello () GNUNET_free_non_null (our_hello); our_hello = hello; - our_hello_version++; GNUNET_PEERINFO_add_peer (peerinfo, our_hello); npos = neighbours; while (npos != NULL) @@ -4885,13 +4873,13 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * * @param cls closure * @param s scheduler to use - * @param serv the initialized server + * @param server the initialized server * @param c configuration to use */ static void run (void *cls, struct GNUNET_SCHEDULER_Handle *s, - struct GNUNET_SERVER_Handle *serv, + struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c) { static const struct GNUNET_SERVER_MessageHandler handlers[] = { @@ -4984,7 +4972,6 @@ run (void *cls, GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key), &my_identity.hashPubKey); /* setup notification */ - server = serv; GNUNET_SERVER_disconnect_notify (server, &client_disconnect_notification, NULL); /* load plugins... */ -- cgit v1.2.3