From: Christian Grothoff Date: Sun, 17 Jan 2010 21:07:12 +0000 (+0000) Subject: fixes X-Git-Tag: initial-import-from-subversion-38251~22956 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=96f959b206cb03d23456630db6c9567bd0e807b2;p=oweals%2Fgnunet.git fixes --- diff --git a/src/hostlist/test_gnunet_daemon_hostlist.c b/src/hostlist/test_gnunet_daemon_hostlist.c index 0d5ab561d..904990a83 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist.c +++ b/src/hostlist/test_gnunet_daemon_hostlist.c @@ -62,10 +62,16 @@ static struct PeerContext p2; static void clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { - GNUNET_TRANSPORT_disconnect (p1.th); - p1.th = NULL; - GNUNET_TRANSPORT_disconnect (p2.th); - p2.th = NULL; + if (p1.th != NULL) + { + GNUNET_TRANSPORT_disconnect (p1.th); + p1.th = NULL; + } + if (p2.th != NULL) + { + GNUNET_TRANSPORT_disconnect (p2.th); + p2.th = NULL; + } GNUNET_SCHEDULER_shutdown (sched); } @@ -99,13 +105,16 @@ notify_connect (void *cls, return; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected, shutting down.\n"); - GNUNET_assert (ok == 4); ok = 0; - GNUNET_SCHEDULER_cancel (sched, - timeout_task); - timeout_task = GNUNET_SCHEDULER_NO_TASK; - GNUNET_SCHEDULER_add_now (sched, - &clean_up, NULL); + if (timeout_task != GNUNET_SCHEDULER_NO_TASK) + { + GNUNET_SCHEDULER_cancel (sched, + timeout_task); + timeout_task = GNUNET_SCHEDULER_NO_TASK; + } + GNUNET_SCHEDULER_add_delayed (sched, + GNUNET_TIME_UNIT_MINUTES, + &clean_up, NULL); } @@ -121,8 +130,6 @@ process_hello (void *cls, return; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received HELLO, starting hostlist service.\n"); - GNUNET_assert ( (ok >= 2) && (ok <= 3) ); - ok++; GNUNET_ARM_start_services (p->cfg, sched, "hostlist", NULL); } diff --git a/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf b/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf index 844e1ded5..6f19661d6 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf +++ b/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf @@ -8,7 +8,7 @@ PORT = 12964 [transport] PORT = 12965 PLUGINS = tcp -#DEBUG = YES +DEBUG = YES [arm] PORT = 12966 @@ -36,6 +36,7 @@ WEAKRANDOM = YES HTTPPORT = 12980 SERVERS = http://localhost:12981/ OPTIONS = -b -p +DEBUG = YES #BINARY = /home/grothoff/bin/gnunet-daemon-hostlist [topology] diff --git a/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf b/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf index dd5a599b8..ec34c8a8b 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf +++ b/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf @@ -8,7 +8,7 @@ PORT = 22964 [transport] PORT = 22965 PLUGINS = tcp -#DEBUG = YES +DEBUG = YES [arm] PORT = 22966 @@ -36,6 +36,7 @@ WEAKRANDOM = YES HTTPPORT = 12981 SERVERS = http://localhost:12980/ OPTIONS = -b -p +DEBUG = YES #BINARY = /home/grothoff/bin/gnunet-daemon-hostlist [topology] diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c index 3ed2172db..f3479ab7b 100644 --- a/src/peerinfo/peerinfo_api.c +++ b/src/peerinfo/peerinfo_api.c @@ -49,10 +49,12 @@ copy_and_free (void *cls, size_t size, void *buf) if (buf == NULL) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, +#if DEBUG_PEERINFO + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ("Failed to transmit message of type %u to `%s' service.\n"), ntohs (msg->type), "peerinfo"); +#endif GNUNET_free (msg); GNUNET_CLIENT_disconnect (cc->client); GNUNET_free (cc); @@ -112,7 +114,7 @@ GNUNET_PEERINFO_add_peer (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CLIENT_notify_transmit_ready (client, ntohs (pam->header.size), ADD_PEER_TIMEOUT, - GNUNET_YES, + GNUNET_NO, ©_and_free, cc); } diff --git a/src/transport/transport.h b/src/transport/transport.h index 57c312171..fad430009 100644 --- a/src/transport/transport.h +++ b/src/transport/transport.h @@ -27,7 +27,7 @@ #include "gnunet_time_lib.h" #include "gnunet_transport_service.h" -#define DEBUG_TRANSPORT GNUNET_NO +#define DEBUG_TRANSPORT GNUNET_YES /** * For how long do we allow unused bandwidth diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index ecd860675..7adec78c9 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c @@ -378,7 +378,7 @@ transport_notify_ready (void *cls, size_t size, void *buf) if (buf == NULL) { #if DEBUG_TRANSPORT - GNUNET_log (GNUNET_ERROR_TYPE_INFO, + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Could not transmit to transport service, cancelling pending requests\n"); #endif th = h->connect_ready_head; @@ -398,7 +398,8 @@ transport_notify_ready (void *cls, size_t size, void *buf) } GNUNET_assert (0 == th->notify (th->notify_cls, 0, NULL)); GNUNET_free (th); - if (h->connect_ready_head != NULL) schedule_transmission (h); /* FIXME: is this ok? */ + if (h->connect_ready_head != NULL) + schedule_transmission (h); /* FIXME: is this ok? */ return 0; } #if DEBUG_TRANSPORT @@ -409,7 +410,8 @@ transport_notify_ready (void *cls, size_t size, void *buf) ret = 0; h->network_handle = NULL; h->transmission_scheduled = GNUNET_NO; - do + while ((h->connect_ready_head != NULL) && + (h->connect_ready_head->notify_size <= size)) { th = h->connect_ready_head; if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) @@ -433,8 +435,6 @@ transport_notify_ready (void *cls, size_t size, void *buf) n->last_sent += ret; size -= ret; } - while ((h->connect_ready_head != NULL) && - (h->connect_ready_head->notify_size <= size)); if (h->connect_ready_head != NULL) schedule_transmission (h); #if DEBUG_TRANSPORT @@ -1498,6 +1498,16 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle) while (NULL != (n = handle->neighbours)) { handle->neighbours = n->next; + if (NULL != (th = n->transmit_handle)) + { + if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) + { + GNUNET_SCHEDULER_cancel (handle->sched, th->notify_delay_task); + th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; + } + th->notify (th->notify_cls, 0, NULL); + GNUNET_free (th); + } GNUNET_free (n); } while (NULL != (hwl = handle->hwl_head))