diff options
-rw-r--r-- | src/hostlist/test_gnunet_daemon_hostlist.c | 31 | ||||
-rw-r--r-- | src/hostlist/test_gnunet_daemon_hostlist_peer1.conf | 3 | ||||
-rw-r--r-- | src/hostlist/test_gnunet_daemon_hostlist_peer2.conf | 3 | ||||
-rw-r--r-- | src/peerinfo/peerinfo_api.c | 6 | ||||
-rw-r--r-- | src/transport/transport.h | 2 | ||||
-rw-r--r-- | src/transport/transport_api.c | 20 |
6 files changed, 43 insertions, 22 deletions
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; | |||
62 | static void | 62 | static void |
63 | clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 63 | clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
64 | { | 64 | { |
65 | GNUNET_TRANSPORT_disconnect (p1.th); | 65 | if (p1.th != NULL) |
66 | p1.th = NULL; | 66 | { |
67 | GNUNET_TRANSPORT_disconnect (p2.th); | 67 | GNUNET_TRANSPORT_disconnect (p1.th); |
68 | p2.th = NULL; | 68 | p1.th = NULL; |
69 | } | ||
70 | if (p2.th != NULL) | ||
71 | { | ||
72 | GNUNET_TRANSPORT_disconnect (p2.th); | ||
73 | p2.th = NULL; | ||
74 | } | ||
69 | GNUNET_SCHEDULER_shutdown (sched); | 75 | GNUNET_SCHEDULER_shutdown (sched); |
70 | } | 76 | } |
71 | 77 | ||
@@ -99,13 +105,16 @@ notify_connect (void *cls, | |||
99 | return; | 105 | return; |
100 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 106 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
101 | "Peers connected, shutting down.\n"); | 107 | "Peers connected, shutting down.\n"); |
102 | GNUNET_assert (ok == 4); | ||
103 | ok = 0; | 108 | ok = 0; |
104 | GNUNET_SCHEDULER_cancel (sched, | 109 | if (timeout_task != GNUNET_SCHEDULER_NO_TASK) |
105 | timeout_task); | 110 | { |
106 | timeout_task = GNUNET_SCHEDULER_NO_TASK; | 111 | GNUNET_SCHEDULER_cancel (sched, |
107 | GNUNET_SCHEDULER_add_now (sched, | 112 | timeout_task); |
108 | &clean_up, NULL); | 113 | timeout_task = GNUNET_SCHEDULER_NO_TASK; |
114 | } | ||
115 | GNUNET_SCHEDULER_add_delayed (sched, | ||
116 | GNUNET_TIME_UNIT_MINUTES, | ||
117 | &clean_up, NULL); | ||
109 | } | 118 | } |
110 | 119 | ||
111 | 120 | ||
@@ -121,8 +130,6 @@ process_hello (void *cls, | |||
121 | return; | 130 | return; |
122 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 131 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
123 | "Received HELLO, starting hostlist service.\n"); | 132 | "Received HELLO, starting hostlist service.\n"); |
124 | GNUNET_assert ( (ok >= 2) && (ok <= 3) ); | ||
125 | ok++; | ||
126 | GNUNET_ARM_start_services (p->cfg, sched, "hostlist", NULL); | 133 | GNUNET_ARM_start_services (p->cfg, sched, "hostlist", NULL); |
127 | } | 134 | } |
128 | 135 | ||
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 | |||
8 | [transport] | 8 | [transport] |
9 | PORT = 12965 | 9 | PORT = 12965 |
10 | PLUGINS = tcp | 10 | PLUGINS = tcp |
11 | #DEBUG = YES | 11 | DEBUG = YES |
12 | 12 | ||
13 | [arm] | 13 | [arm] |
14 | PORT = 12966 | 14 | PORT = 12966 |
@@ -36,6 +36,7 @@ WEAKRANDOM = YES | |||
36 | HTTPPORT = 12980 | 36 | HTTPPORT = 12980 |
37 | SERVERS = http://localhost:12981/ | 37 | SERVERS = http://localhost:12981/ |
38 | OPTIONS = -b -p | 38 | OPTIONS = -b -p |
39 | DEBUG = YES | ||
39 | #BINARY = /home/grothoff/bin/gnunet-daemon-hostlist | 40 | #BINARY = /home/grothoff/bin/gnunet-daemon-hostlist |
40 | 41 | ||
41 | [topology] | 42 | [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 | |||
8 | [transport] | 8 | [transport] |
9 | PORT = 22965 | 9 | PORT = 22965 |
10 | PLUGINS = tcp | 10 | PLUGINS = tcp |
11 | #DEBUG = YES | 11 | DEBUG = YES |
12 | 12 | ||
13 | [arm] | 13 | [arm] |
14 | PORT = 22966 | 14 | PORT = 22966 |
@@ -36,6 +36,7 @@ WEAKRANDOM = YES | |||
36 | HTTPPORT = 12981 | 36 | HTTPPORT = 12981 |
37 | SERVERS = http://localhost:12980/ | 37 | SERVERS = http://localhost:12980/ |
38 | OPTIONS = -b -p | 38 | OPTIONS = -b -p |
39 | DEBUG = YES | ||
39 | #BINARY = /home/grothoff/bin/gnunet-daemon-hostlist | 40 | #BINARY = /home/grothoff/bin/gnunet-daemon-hostlist |
40 | 41 | ||
41 | [topology] | 42 | [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) | |||
49 | 49 | ||
50 | if (buf == NULL) | 50 | if (buf == NULL) |
51 | { | 51 | { |
52 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 52 | #if DEBUG_PEERINFO |
53 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
53 | _ | 54 | _ |
54 | ("Failed to transmit message of type %u to `%s' service.\n"), | 55 | ("Failed to transmit message of type %u to `%s' service.\n"), |
55 | ntohs (msg->type), "peerinfo"); | 56 | ntohs (msg->type), "peerinfo"); |
57 | #endif | ||
56 | GNUNET_free (msg); | 58 | GNUNET_free (msg); |
57 | GNUNET_CLIENT_disconnect (cc->client); | 59 | GNUNET_CLIENT_disconnect (cc->client); |
58 | GNUNET_free (cc); | 60 | GNUNET_free (cc); |
@@ -112,7 +114,7 @@ GNUNET_PEERINFO_add_peer (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
112 | GNUNET_CLIENT_notify_transmit_ready (client, | 114 | GNUNET_CLIENT_notify_transmit_ready (client, |
113 | ntohs (pam->header.size), | 115 | ntohs (pam->header.size), |
114 | ADD_PEER_TIMEOUT, | 116 | ADD_PEER_TIMEOUT, |
115 | GNUNET_YES, | 117 | GNUNET_NO, |
116 | ©_and_free, cc); | 118 | ©_and_free, cc); |
117 | } | 119 | } |
118 | 120 | ||
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 @@ | |||
27 | #include "gnunet_time_lib.h" | 27 | #include "gnunet_time_lib.h" |
28 | #include "gnunet_transport_service.h" | 28 | #include "gnunet_transport_service.h" |
29 | 29 | ||
30 | #define DEBUG_TRANSPORT GNUNET_NO | 30 | #define DEBUG_TRANSPORT GNUNET_YES |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * For how long do we allow unused bandwidth | 33 | * 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) | |||
378 | if (buf == NULL) | 378 | if (buf == NULL) |
379 | { | 379 | { |
380 | #if DEBUG_TRANSPORT | 380 | #if DEBUG_TRANSPORT |
381 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 381 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
382 | "Could not transmit to transport service, cancelling pending requests\n"); | 382 | "Could not transmit to transport service, cancelling pending requests\n"); |
383 | #endif | 383 | #endif |
384 | th = h->connect_ready_head; | 384 | th = h->connect_ready_head; |
@@ -398,7 +398,8 @@ transport_notify_ready (void *cls, size_t size, void *buf) | |||
398 | } | 398 | } |
399 | GNUNET_assert (0 == th->notify (th->notify_cls, 0, NULL)); | 399 | GNUNET_assert (0 == th->notify (th->notify_cls, 0, NULL)); |
400 | GNUNET_free (th); | 400 | GNUNET_free (th); |
401 | if (h->connect_ready_head != NULL) schedule_transmission (h); /* FIXME: is this ok? */ | 401 | if (h->connect_ready_head != NULL) |
402 | schedule_transmission (h); /* FIXME: is this ok? */ | ||
402 | return 0; | 403 | return 0; |
403 | } | 404 | } |
404 | #if DEBUG_TRANSPORT | 405 | #if DEBUG_TRANSPORT |
@@ -409,7 +410,8 @@ transport_notify_ready (void *cls, size_t size, void *buf) | |||
409 | ret = 0; | 410 | ret = 0; |
410 | h->network_handle = NULL; | 411 | h->network_handle = NULL; |
411 | h->transmission_scheduled = GNUNET_NO; | 412 | h->transmission_scheduled = GNUNET_NO; |
412 | do | 413 | while ((h->connect_ready_head != NULL) && |
414 | (h->connect_ready_head->notify_size <= size)) | ||
413 | { | 415 | { |
414 | th = h->connect_ready_head; | 416 | th = h->connect_ready_head; |
415 | if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) | 417 | if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) |
@@ -433,8 +435,6 @@ transport_notify_ready (void *cls, size_t size, void *buf) | |||
433 | n->last_sent += ret; | 435 | n->last_sent += ret; |
434 | size -= ret; | 436 | size -= ret; |
435 | } | 437 | } |
436 | while ((h->connect_ready_head != NULL) && | ||
437 | (h->connect_ready_head->notify_size <= size)); | ||
438 | if (h->connect_ready_head != NULL) | 438 | if (h->connect_ready_head != NULL) |
439 | schedule_transmission (h); | 439 | schedule_transmission (h); |
440 | #if DEBUG_TRANSPORT | 440 | #if DEBUG_TRANSPORT |
@@ -1498,6 +1498,16 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle) | |||
1498 | while (NULL != (n = handle->neighbours)) | 1498 | while (NULL != (n = handle->neighbours)) |
1499 | { | 1499 | { |
1500 | handle->neighbours = n->next; | 1500 | handle->neighbours = n->next; |
1501 | if (NULL != (th = n->transmit_handle)) | ||
1502 | { | ||
1503 | if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) | ||
1504 | { | ||
1505 | GNUNET_SCHEDULER_cancel (handle->sched, th->notify_delay_task); | ||
1506 | th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; | ||
1507 | } | ||
1508 | th->notify (th->notify_cls, 0, NULL); | ||
1509 | GNUNET_free (th); | ||
1510 | } | ||
1501 | GNUNET_free (n); | 1511 | GNUNET_free (n); |
1502 | } | 1512 | } |
1503 | while (NULL != (hwl = handle->hwl_head)) | 1513 | while (NULL != (hwl = handle->hwl_head)) |