aboutsummaryrefslogtreecommitdiff
path: root/src/core/gnunet-service-core_neighbours.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-10-05 16:35:44 +0000
committerChristian Grothoff <christian@grothoff.org>2015-10-05 16:35:44 +0000
commit4dcb414e2faabc800577c25dec3b63e3ceaaa84b (patch)
treec9e7b5139a3f04bbcd65ddfc10d1bab05e6e0741 /src/core/gnunet-service-core_neighbours.c
parentef76e090bf279f25038c03eec4eac96bbfbe952e (diff)
downloadgnunet-4dcb414e2faabc800577c25dec3b63e3ceaaa84b.tar.gz
gnunet-4dcb414e2faabc800577c25dec3b63e3ceaaa84b.zip
adding DEBUG logic for #3863
Diffstat (limited to 'src/core/gnunet-service-core_neighbours.c')
-rw-r--r--src/core/gnunet-service-core_neighbours.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/core/gnunet-service-core_neighbours.c b/src/core/gnunet-service-core_neighbours.c
index 5e5ed4db3..f89206dfe 100644
--- a/src/core/gnunet-service-core_neighbours.c
+++ b/src/core/gnunet-service-core_neighbours.c
@@ -57,9 +57,14 @@ struct NeighbourMessageEntry
57 struct GNUNET_TIME_Absolute deadline; 57 struct GNUNET_TIME_Absolute deadline;
58 58
59 /** 59 /**
60 * How long is the message? (number of bytes following the "struct 60 * What time did we submit the request?
61 * MessageEntry", but not including the size of "struct 61 */
62 * MessageEntry" itself!) 62 struct GNUNET_TIME_Absolute submission_time;
63
64 /**
65 * How long is the message? (number of bytes following the `struct
66 * MessageEntry`, but not including the size of `struct
67 * MessageEntry` itself!)
63 */ 68 */
64 size_t size; 69 size_t size;
65 70
@@ -157,7 +162,7 @@ free_neighbour (struct Neighbour *n)
157 struct NeighbourMessageEntry *m; 162 struct NeighbourMessageEntry *m;
158 163
159 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 164 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
160 "Destroying neighbour entry for peer `%4s'\n", 165 "Destroying neighbour entry for peer `%s'\n",
161 GNUNET_i2s (&n->peer)); 166 GNUNET_i2s (&n->peer));
162 while (NULL != (m = n->message_head)) 167 while (NULL != (m = n->message_head))
163 { 168 {
@@ -227,6 +232,7 @@ transmit_ready (void *cls,
227 struct NeighbourMessageEntry *m; 232 struct NeighbourMessageEntry *m;
228 size_t ret; 233 size_t ret;
229 char *cbuf; 234 char *cbuf;
235 struct GNUNET_TIME_Relative delay;
230 236
231 n->th = NULL; 237 n->th = NULL;
232 m = n->message_head; 238 m = n->message_head;
@@ -250,18 +256,31 @@ transmit_ready (void *cls,
250 process_queue (n); 256 process_queue (n);
251 return 0; 257 return 0;
252 } 258 }
259 delay = GNUNET_TIME_absolute_get_duration (m->submission_time);
253 cbuf = buf; 260 cbuf = buf;
254 GNUNET_assert (size >= m->size); 261 GNUNET_assert (size >= m->size);
255 memcpy (cbuf, 262 memcpy (cbuf,
256 &m[1], 263 &m[1],
257 m->size); 264 m->size);
258 ret = m->size; 265 ret = m->size;
259 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 266 if (delay.rel_value_us > GNUNET_TIME_UNIT_SECONDS.rel_value_us)
260 "Copied message of type %u and size %u into transport buffer for `%4s'\n", 267 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
268 "Copied message of type %u and size %u into transport buffer for `%s' with delay of %s\n",
261 (unsigned int) 269 (unsigned int)
262 ntohs (((struct GNUNET_MessageHeader *) &m[1])->type), 270 ntohs (((struct GNUNET_MessageHeader *) &m[1])->type),
263 (unsigned int) ret, 271 (unsigned int) ret,
264 GNUNET_i2s (&n->peer)); 272 GNUNET_i2s (&n->peer),
273 GNUNET_STRINGS_relative_time_to_string (delay,
274 GNUNET_YES));
275 else
276 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
277 "Copied message of type %u and size %u into transport buffer for `%s' with delay of %s\n",
278 (unsigned int)
279 ntohs (((struct GNUNET_MessageHeader *) &m[1])->type),
280 (unsigned int) ret,
281 GNUNET_i2s (&n->peer),
282 GNUNET_STRINGS_relative_time_to_string (delay,
283 GNUNET_YES));
265 GNUNET_free (m); 284 GNUNET_free (m);
266 n->has_excess_bandwidth = GNUNET_NO; 285 n->has_excess_bandwidth = GNUNET_NO;
267 process_queue (n); 286 process_queue (n);
@@ -295,11 +314,12 @@ process_queue (struct Neighbour *n)
295 return; 314 return;
296 } 315 }
297 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 316 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
298 "Asking transport for transmission of %u bytes to `%4s' in next %s\n", 317 "Asking transport for transmission of %u bytes to `%s' in next %s\n",
299 (unsigned int) m->size, 318 (unsigned int) m->size,
300 GNUNET_i2s (&n->peer), 319 GNUNET_i2s (&n->peer),
301 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (m->deadline), 320 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (m->deadline),
302 GNUNET_NO)); 321 GNUNET_NO));
322 m->submission_time = GNUNET_TIME_absolute_get ();
303 n->th 323 n->th
304 = GNUNET_TRANSPORT_notify_transmit_ready (transport, 324 = GNUNET_TRANSPORT_notify_transmit_ready (transport,
305 &n->peer, 325 &n->peer,