diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-12-13 20:37:51 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-12-13 20:37:51 +0000 |
commit | d48352bb16b9cdf8b397d4b0a2154271f034edfe (patch) | |
tree | de7843ffd23cabb4b3f18a4a4898999011fdb5cc /src/core/gnunet-service-core_neighbours.c | |
parent | 8723949c5796c40fe262b4843b4838dc0e67ae5c (diff) | |
download | gnunet-d48352bb16b9cdf8b397d4b0a2154271f034edfe.tar.gz gnunet-d48352bb16b9cdf8b397d4b0a2154271f034edfe.zip |
-style fixes
Diffstat (limited to 'src/core/gnunet-service-core_neighbours.c')
-rw-r--r-- | src/core/gnunet-service-core_neighbours.c | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/src/core/gnunet-service-core_neighbours.c b/src/core/gnunet-service-core_neighbours.c index eca5393a2..20055081b 100644 --- a/src/core/gnunet-service-core_neighbours.c +++ b/src/core/gnunet-service-core_neighbours.c | |||
@@ -266,10 +266,10 @@ process_queue (struct Neighbour *n) | |||
266 | { | 266 | { |
267 | struct NeighbourMessageEntry *m; | 267 | struct NeighbourMessageEntry *m; |
268 | 268 | ||
269 | if (n->th != NULL) | 269 | if (NULL != n->th) |
270 | return; /* request already pending */ | 270 | return; /* request already pending */ |
271 | m = n->message_head; | 271 | m = n->message_head; |
272 | if (m == NULL) | 272 | if (NULL == m) |
273 | { | 273 | { |
274 | /* notify sessions that the queue is empty and more messages | 274 | /* notify sessions that the queue is empty and more messages |
275 | * could thus be queued now */ | 275 | * could thus be queued now */ |
@@ -278,25 +278,30 @@ process_queue (struct Neighbour *n) | |||
278 | } | 278 | } |
279 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 279 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
280 | "Asking transport for transmission of %u bytes to `%4s' in next %s\n", | 280 | "Asking transport for transmission of %u bytes to `%4s' in next %s\n", |
281 | (unsigned int) m->size, GNUNET_i2s (&n->peer), | 281 | (unsigned int) m->size, |
282 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (m->deadline), GNUNET_NO)); | 282 | GNUNET_i2s (&n->peer), |
283 | n->th = | 283 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (m->deadline), |
284 | GNUNET_TRANSPORT_notify_transmit_ready (transport, &n->peer, m->size, | 284 | GNUNET_NO)); |
285 | GNUNET_TIME_absolute_get_remaining | 285 | n->th |
286 | (m->deadline), &transmit_ready, | 286 | = GNUNET_TRANSPORT_notify_transmit_ready (transport, |
287 | &n->peer, | ||
288 | m->size, | ||
289 | GNUNET_TIME_absolute_get_remaining (m->deadline), | ||
290 | &transmit_ready, | ||
287 | n); | 291 | n); |
288 | if (n->th != NULL) | 292 | if (NULL != n->th) |
289 | return; | 293 | return; |
290 | /* message request too large or duplicate request */ | 294 | /* message request too large or duplicate request */ |
291 | GNUNET_break (0); | 295 | GNUNET_break (0); |
292 | /* discard encrypted message */ | 296 | /* discard encrypted message */ |
293 | GNUNET_CONTAINER_DLL_remove (n->message_head, n->message_tail, m); | 297 | GNUNET_CONTAINER_DLL_remove (n->message_head, |
298 | n->message_tail, | ||
299 | m); | ||
294 | GNUNET_free (m); | 300 | GNUNET_free (m); |
295 | process_queue (n); | 301 | process_queue (n); |
296 | } | 302 | } |
297 | 303 | ||
298 | 304 | ||
299 | |||
300 | /** | 305 | /** |
301 | * Function called by transport to notify us that | 306 | * Function called by transport to notify us that |
302 | * a peer connected to us (on the network level). | 307 | * a peer connected to us (on the network level). |
@@ -310,7 +315,9 @@ handle_transport_notify_connect (void *cls, | |||
310 | { | 315 | { |
311 | struct Neighbour *n; | 316 | struct Neighbour *n; |
312 | 317 | ||
313 | if (0 == memcmp (peer, &GSC_my_identity, sizeof (struct GNUNET_PeerIdentity))) | 318 | if (0 == memcmp (peer, |
319 | &GSC_my_identity, | ||
320 | sizeof (struct GNUNET_PeerIdentity))) | ||
314 | { | 321 | { |
315 | GNUNET_break (0); | 322 | GNUNET_break (0); |
316 | return; | 323 | return; |
@@ -356,7 +363,7 @@ handle_transport_notify_disconnect (void *cls, | |||
356 | "Peer `%4s' disconnected from us; received notification from transport.\n", | 363 | "Peer `%4s' disconnected from us; received notification from transport.\n", |
357 | GNUNET_i2s (peer)); | 364 | GNUNET_i2s (peer)); |
358 | n = find_neighbour (peer); | 365 | n = find_neighbour (peer); |
359 | if (n == NULL) | 366 | if (NULL == n) |
360 | { | 367 | { |
361 | GNUNET_break (0); | 368 | GNUNET_break (0); |
362 | return; | 369 | return; |
@@ -373,7 +380,8 @@ handle_transport_notify_disconnect (void *cls, | |||
373 | * @param message the message | 380 | * @param message the message |
374 | */ | 381 | */ |
375 | static void | 382 | static void |
376 | handle_transport_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | 383 | handle_transport_receive (void *cls, |
384 | const struct GNUNET_PeerIdentity *peer, | ||
377 | const struct GNUNET_MessageHeader *message) | 385 | const struct GNUNET_MessageHeader *message) |
378 | { | 386 | { |
379 | struct Neighbour *n; | 387 | struct Neighbour *n; |
@@ -414,9 +422,9 @@ handle_transport_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
414 | break; | 422 | break; |
415 | default: | 423 | default: |
416 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 424 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
417 | _ | 425 | _("Unsupported message of type %u (%u bytes) received from peer `%s'\n"), |
418 | ("Unsupported message of type %u (%u bytes) received from peer `%s'\n"), | 426 | (unsigned int) type, |
419 | (unsigned int) type, (unsigned int) ntohs (message->size), | 427 | (unsigned int) ntohs (message->size), |
420 | GNUNET_i2s (peer)); | 428 | GNUNET_i2s (peer)); |
421 | return; | 429 | return; |
422 | } | 430 | } |
@@ -561,7 +569,8 @@ GSC_NEIGHBOURS_done () | |||
561 | } | 569 | } |
562 | if (NULL != neighbours) | 570 | if (NULL != neighbours) |
563 | { | 571 | { |
564 | GNUNET_CONTAINER_multipeermap_iterate (neighbours, &free_neighbour_helper, | 572 | GNUNET_CONTAINER_multipeermap_iterate (neighbours, |
573 | &free_neighbour_helper, | ||
565 | NULL); | 574 | NULL); |
566 | GNUNET_CONTAINER_multipeermap_destroy (neighbours); | 575 | GNUNET_CONTAINER_multipeermap_destroy (neighbours); |
567 | neighbours = NULL; | 576 | neighbours = NULL; |