diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-09-13 08:15:04 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-09-13 08:15:04 +0000 |
commit | 983b7b09169634e585949bf4d5e09336cbf76afc (patch) | |
tree | 53857686a346aa2befb0ecfb884ac995459e5647 /src/transport/test_transport_api.c | |
parent | 2e2d452622803bd082c5e9d197e8a6e3c84e4d93 (diff) | |
download | gnunet-983b7b09169634e585949bf4d5e09336cbf76afc.tar.gz gnunet-983b7b09169634e585949bf4d5e09336cbf76afc.zip |
no hard fail in case out transmit_ready timeout instead shut peers correctly down
Diffstat (limited to 'src/transport/test_transport_api.c')
-rw-r--r-- | src/transport/test_transport_api.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index 92f1b9c95..ba7dc7cc1 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c | |||
@@ -46,7 +46,7 @@ | |||
46 | /** | 46 | /** |
47 | * How long until we give up on transmitting the message? | 47 | * How long until we give up on transmitting the message? |
48 | */ | 48 | */ |
49 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 300) | 49 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120) |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * How long until we give up on transmitting the message? | 52 | * How long until we give up on transmitting the message? |
@@ -164,6 +164,17 @@ notify_ready (void *cls, size_t size, void *buf) | |||
164 | 164 | ||
165 | th = NULL; | 165 | th = NULL; |
166 | 166 | ||
167 | if (buf == NULL) | ||
168 | { | ||
169 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
170 | "Timeout occurred while waiting for transmit_ready\n"); | ||
171 | if (GNUNET_SCHEDULER_NO_TASK != die_task) | ||
172 | GNUNET_SCHEDULER_cancel (die_task); | ||
173 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); | ||
174 | ok = 42; | ||
175 | return 0; | ||
176 | } | ||
177 | |||
167 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 178 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
168 | "Transmitting message with %u bytes to peer %s\n", | 179 | "Transmitting message with %u bytes to peer %s\n", |
169 | sizeof (struct GNUNET_MessageHeader), GNUNET_i2s (&p->id)); | 180 | sizeof (struct GNUNET_MessageHeader), GNUNET_i2s (&p->id)); |
@@ -204,8 +215,9 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
204 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) | 215 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) |
205 | return; | 216 | return; |
206 | 217 | ||
207 | th = GNUNET_TRANSPORT_notify_transmit_ready (p1->th, &p2->id, 256, 0, TIMEOUT, | 218 | th = GNUNET_TRANSPORT_notify_transmit_ready (p1->th, &p2->id, 256, 0, |
208 | ¬ify_ready, &p1); | 219 | TIMEOUT_TRANSMIT, ¬ify_ready, |
220 | &p1); | ||
209 | } | 221 | } |
210 | 222 | ||
211 | static void | 223 | static void |