diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-10-06 20:55:28 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-10-06 20:55:28 +0000 |
commit | 61c39c60565b386e0e12ea669556b030e8cd7180 (patch) | |
tree | 59109aeab8297bdc996faca8c4e38ec7426c36cf /src/dv | |
parent | 780eb09dd8040ecf8649d40ddf8314464e0fc48e (diff) | |
download | gnunet-61c39c60565b386e0e12ea669556b030e8cd7180.tar.gz gnunet-61c39c60565b386e0e12ea669556b030e8cd7180.zip |
-remove trailing whitespace
Diffstat (limited to 'src/dv')
-rw-r--r-- | src/dv/dv.h | 4 | ||||
-rw-r--r-- | src/dv/dv_api.c | 26 | ||||
-rw-r--r-- | src/dv/gnunet-dv.c | 10 | ||||
-rw-r--r-- | src/dv/gnunet-service-dv.c | 128 | ||||
-rw-r--r-- | src/dv/plugin_transport_dv.c | 46 | ||||
-rw-r--r-- | src/dv/test_transport_blacklist.c | 2 |
6 files changed, 108 insertions, 108 deletions
diff --git a/src/dv/dv.h b/src/dv/dv.h index c0247218e..c0a4828a2 100644 --- a/src/dv/dv.h +++ b/src/dv/dv.h | |||
@@ -142,7 +142,7 @@ struct GNUNET_DV_AckMessage | |||
142 | /** | 142 | /** |
143 | * Type: GNUNET_MESSAGE_TYPE_DV_SEND_ACK or | 143 | * Type: GNUNET_MESSAGE_TYPE_DV_SEND_ACK or |
144 | * GNUNET_MESSAGE_TYPE_DV_SEND_NACK. | 144 | * GNUNET_MESSAGE_TYPE_DV_SEND_NACK. |
145 | */ | 145 | */ |
146 | struct GNUNET_MessageHeader header; | 146 | struct GNUNET_MessageHeader header; |
147 | 147 | ||
148 | /** | 148 | /** |
@@ -166,7 +166,7 @@ struct GNUNET_DV_DistanceUpdateMessage | |||
166 | { | 166 | { |
167 | /** | 167 | /** |
168 | * Type: GNUNET_MESSAGE_TYPE_DV_DISTANCE_CHANGED. | 168 | * Type: GNUNET_MESSAGE_TYPE_DV_DISTANCE_CHANGED. |
169 | */ | 169 | */ |
170 | struct GNUNET_MessageHeader header; | 170 | struct GNUNET_MessageHeader header; |
171 | 171 | ||
172 | /** | 172 | /** |
diff --git a/src/dv/dv_api.c b/src/dv/dv_api.c index 1bbb789f9..412ab47ad 100644 --- a/src/dv/dv_api.c +++ b/src/dv/dv_api.c | |||
@@ -63,7 +63,7 @@ struct GNUNET_DV_TransmitHandle | |||
63 | * Closure for 'cb'. | 63 | * Closure for 'cb'. |
64 | */ | 64 | */ |
65 | void *cb_cls; | 65 | void *cb_cls; |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * The actual message (allocated at the end of this struct). | 68 | * The actual message (allocated at the end of this struct). |
69 | */ | 69 | */ |
@@ -78,7 +78,7 @@ struct GNUNET_DV_TransmitHandle | |||
78 | * UID of our message, if any. | 78 | * UID of our message, if any. |
79 | */ | 79 | */ |
80 | uint32_t uid; | 80 | uint32_t uid; |
81 | 81 | ||
82 | }; | 82 | }; |
83 | 83 | ||
84 | 84 | ||
@@ -107,7 +107,7 @@ struct GNUNET_DV_ServiceHandle | |||
107 | * Closure for the callbacks. | 107 | * Closure for the callbacks. |
108 | */ | 108 | */ |
109 | void *cls; | 109 | void *cls; |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * Function to call on connect events. | 112 | * Function to call on connect events. |
113 | */ | 113 | */ |
@@ -221,12 +221,12 @@ start_transmit (struct GNUNET_DV_ServiceHandle *sh) | |||
221 | if (NULL != sh->th) | 221 | if (NULL != sh->th) |
222 | return; | 222 | return; |
223 | if (NULL == sh->th_head) | 223 | if (NULL == sh->th_head) |
224 | return; | 224 | return; |
225 | sh->th = | 225 | sh->th = |
226 | GNUNET_CLIENT_notify_transmit_ready (sh->client, | 226 | GNUNET_CLIENT_notify_transmit_ready (sh->client, |
227 | ntohs (sh->th_head->msg->size), | 227 | ntohs (sh->th_head->msg->size), |
228 | GNUNET_TIME_UNIT_FOREVER_REL, | 228 | GNUNET_TIME_UNIT_FOREVER_REL, |
229 | GNUNET_NO, | 229 | GNUNET_NO, |
230 | &transmit_pending, sh); | 230 | &transmit_pending, sh); |
231 | } | 231 | } |
232 | 232 | ||
@@ -291,7 +291,7 @@ process_ack (void *cls, | |||
291 | * @param msg the message that was received | 291 | * @param msg the message that was received |
292 | */ | 292 | */ |
293 | static void | 293 | static void |
294 | handle_message_receipt (void *cls, | 294 | handle_message_receipt (void *cls, |
295 | const struct GNUNET_MessageHeader *msg) | 295 | const struct GNUNET_MessageHeader *msg) |
296 | { | 296 | { |
297 | struct GNUNET_DV_ServiceHandle *sh = cls; | 297 | struct GNUNET_DV_ServiceHandle *sh = cls; |
@@ -302,7 +302,7 @@ handle_message_receipt (void *cls, | |||
302 | const struct GNUNET_MessageHeader *payload; | 302 | const struct GNUNET_MessageHeader *payload; |
303 | const struct GNUNET_DV_AckMessage *ack; | 303 | const struct GNUNET_DV_AckMessage *ack; |
304 | struct AckContext ctx; | 304 | struct AckContext ctx; |
305 | 305 | ||
306 | if (NULL == msg) | 306 | if (NULL == msg) |
307 | { | 307 | { |
308 | /* Connection closed */ | 308 | /* Connection closed */ |
@@ -389,7 +389,7 @@ handle_message_receipt (void *cls, | |||
389 | reconnect (sh); | 389 | reconnect (sh); |
390 | break; | 390 | break; |
391 | } | 391 | } |
392 | GNUNET_CLIENT_receive (sh->client, | 392 | GNUNET_CLIENT_receive (sh->client, |
393 | &handle_message_receipt, sh, | 393 | &handle_message_receipt, sh, |
394 | GNUNET_TIME_UNIT_FOREVER_REL); | 394 | GNUNET_TIME_UNIT_FOREVER_REL); |
395 | } | 395 | } |
@@ -402,7 +402,7 @@ handle_message_receipt (void *cls, | |||
402 | * @param size number of bytes available in buf | 402 | * @param size number of bytes available in buf |
403 | * @param buf where to copy the message | 403 | * @param buf where to copy the message |
404 | * @return number of bytes written to buf | 404 | * @return number of bytes written to buf |
405 | */ | 405 | */ |
406 | static size_t | 406 | static size_t |
407 | transmit_start (void *cls, | 407 | transmit_start (void *cls, |
408 | size_t size, | 408 | size_t size, |
@@ -464,7 +464,7 @@ cleanup_send_cb (void *cls, | |||
464 | */ | 464 | */ |
465 | static void | 465 | static void |
466 | reconnect (struct GNUNET_DV_ServiceHandle *sh) | 466 | reconnect (struct GNUNET_DV_ServiceHandle *sh) |
467 | { | 467 | { |
468 | if (NULL != sh->th) | 468 | if (NULL != sh->th) |
469 | { | 469 | { |
470 | GNUNET_CLIENT_notify_transmit_ready_cancel (sh->th); | 470 | GNUNET_CLIENT_notify_transmit_ready_cancel (sh->th); |
@@ -538,7 +538,7 @@ void | |||
538 | GNUNET_DV_service_disconnect (struct GNUNET_DV_ServiceHandle *sh) | 538 | GNUNET_DV_service_disconnect (struct GNUNET_DV_ServiceHandle *sh) |
539 | { | 539 | { |
540 | struct GNUNET_DV_TransmitHandle *pos; | 540 | struct GNUNET_DV_TransmitHandle *pos; |
541 | 541 | ||
542 | if (NULL == sh) | 542 | if (NULL == sh) |
543 | return; | 543 | return; |
544 | if (NULL != sh->th) | 544 | if (NULL != sh->th) |
@@ -553,7 +553,7 @@ GNUNET_DV_service_disconnect (struct GNUNET_DV_ServiceHandle *sh) | |||
553 | pos); | 553 | pos); |
554 | GNUNET_free (pos); | 554 | GNUNET_free (pos); |
555 | } | 555 | } |
556 | if (NULL != sh->client) | 556 | if (NULL != sh->client) |
557 | { | 557 | { |
558 | GNUNET_CLIENT_disconnect (sh->client); | 558 | GNUNET_CLIENT_disconnect (sh->client); |
559 | sh->client = NULL; | 559 | sh->client = NULL; |
@@ -607,7 +607,7 @@ GNUNET_DV_send (struct GNUNET_DV_ServiceHandle *sh, | |||
607 | th->msg = (const struct GNUNET_MessageHeader *) &th[1]; | 607 | th->msg = (const struct GNUNET_MessageHeader *) &th[1]; |
608 | sm = (struct GNUNET_DV_SendMessage *) &th[1]; | 608 | sm = (struct GNUNET_DV_SendMessage *) &th[1]; |
609 | sm->header.type = htons (GNUNET_MESSAGE_TYPE_DV_SEND); | 609 | sm->header.type = htons (GNUNET_MESSAGE_TYPE_DV_SEND); |
610 | sm->header.size = htons (sizeof (struct GNUNET_DV_SendMessage) + | 610 | sm->header.size = htons (sizeof (struct GNUNET_DV_SendMessage) + |
611 | ntohs (msg->size)); | 611 | ntohs (msg->size)); |
612 | if (0 == sh->uid_gen) | 612 | if (0 == sh->uid_gen) |
613 | sh->uid_gen = 1; | 613 | sh->uid_gen = 1; |
diff --git a/src/dv/gnunet-dv.c b/src/dv/gnunet-dv.c index 77324978e..43af3458e 100644 --- a/src/dv/gnunet-dv.c +++ b/src/dv/gnunet-dv.c | |||
@@ -44,7 +44,7 @@ static int verbose; | |||
44 | * @param peer newly connected peer | 44 | * @param peer newly connected peer |
45 | * @param distance distance to the peer | 45 | * @param distance distance to the peer |
46 | */ | 46 | */ |
47 | static void | 47 | static void |
48 | connect_cb (void *cls, | 48 | connect_cb (void *cls, |
49 | const struct GNUNET_PeerIdentity *peer, | 49 | const struct GNUNET_PeerIdentity *peer, |
50 | uint32_t distance) | 50 | uint32_t distance) |
@@ -62,7 +62,7 @@ connect_cb (void *cls, | |||
62 | * @param peer connected peer | 62 | * @param peer connected peer |
63 | * @param distance new distance to the peer | 63 | * @param distance new distance to the peer |
64 | */ | 64 | */ |
65 | static void | 65 | static void |
66 | change_cb (void *cls, | 66 | change_cb (void *cls, |
67 | const struct GNUNET_PeerIdentity *peer, | 67 | const struct GNUNET_PeerIdentity *peer, |
68 | uint32_t distance) | 68 | uint32_t distance) |
@@ -79,7 +79,7 @@ change_cb (void *cls, | |||
79 | * @param cls closure | 79 | * @param cls closure |
80 | * @param peer peer that disconnected | 80 | * @param peer peer that disconnected |
81 | */ | 81 | */ |
82 | static void | 82 | static void |
83 | disconnect_cb (void *cls, | 83 | disconnect_cb (void *cls, |
84 | const struct GNUNET_PeerIdentity *peer) | 84 | const struct GNUNET_PeerIdentity *peer) |
85 | { | 85 | { |
@@ -96,7 +96,7 @@ disconnect_cb (void *cls, | |||
96 | * @param distance how far did the message travel | 96 | * @param distance how far did the message travel |
97 | * @param msg actual message payload | 97 | * @param msg actual message payload |
98 | */ | 98 | */ |
99 | static void | 99 | static void |
100 | message_cb (void *cls, | 100 | message_cb (void *cls, |
101 | const struct GNUNET_PeerIdentity *sender, | 101 | const struct GNUNET_PeerIdentity *sender, |
102 | uint32_t distance, | 102 | uint32_t distance, |
@@ -171,7 +171,7 @@ main (int argc, char *const *argv) | |||
171 | return 2; | 171 | return 2; |
172 | 172 | ||
173 | res = GNUNET_PROGRAM_run (argc, argv, "gnunet-dv", | 173 | res = GNUNET_PROGRAM_run (argc, argv, "gnunet-dv", |
174 | gettext_noop ("Print information about DV state"), | 174 | gettext_noop ("Print information about DV state"), |
175 | options, &run, | 175 | options, &run, |
176 | NULL); | 176 | NULL); |
177 | GNUNET_free ((void *) argv); | 177 | GNUNET_free ((void *) argv); |
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index 19303ed83..cd4517164 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c | |||
@@ -92,7 +92,7 @@ struct Target | |||
92 | 92 | ||
93 | /** | 93 | /** |
94 | * Message exchanged between DV services (via core), requesting a | 94 | * Message exchanged between DV services (via core), requesting a |
95 | * message to be routed. | 95 | * message to be routed. |
96 | */ | 96 | */ |
97 | struct RouteMessage | 97 | struct RouteMessage |
98 | { | 98 | { |
@@ -176,7 +176,7 @@ struct DirectNeighbor | |||
176 | * with other applications. | 176 | * with other applications. |
177 | */ | 177 | */ |
178 | struct GNUNET_HashCode real_session_id; | 178 | struct GNUNET_HashCode real_session_id; |
179 | 179 | ||
180 | /** | 180 | /** |
181 | * Head of linked list of messages to send to this peer. | 181 | * Head of linked list of messages to send to this peer. |
182 | */ | 182 | */ |
@@ -197,7 +197,7 @@ struct DirectNeighbor | |||
197 | * Keys are peer identities, values are 'struct Target' entries. | 197 | * Keys are peer identities, values are 'struct Target' entries. |
198 | * Note that the distances in the targets are from the point-of-view | 198 | * Note that the distances in the targets are from the point-of-view |
199 | * of the peer, not from us! | 199 | * of the peer, not from us! |
200 | */ | 200 | */ |
201 | struct GNUNET_CONTAINER_MultiPeerMap *neighbor_table; | 201 | struct GNUNET_CONTAINER_MultiPeerMap *neighbor_table; |
202 | 202 | ||
203 | /** | 203 | /** |
@@ -206,7 +206,7 @@ struct DirectNeighbor | |||
206 | * Keys are peer identities, values are 'struct Target' entries. | 206 | * Keys are peer identities, values are 'struct Target' entries. |
207 | * Note that the distances in the targets are from the point-of-view | 207 | * Note that the distances in the targets are from the point-of-view |
208 | * of the peer, not from us! | 208 | * of the peer, not from us! |
209 | */ | 209 | */ |
210 | struct GNUNET_CONTAINER_MultiPeerMap *neighbor_table_consensus; | 210 | struct GNUNET_CONTAINER_MultiPeerMap *neighbor_table_consensus; |
211 | 211 | ||
212 | /** | 212 | /** |
@@ -318,13 +318,13 @@ struct ConsensusSet | |||
318 | 318 | ||
319 | /** | 319 | /** |
320 | * Peermap of all of our neighbors; processing these usually requires | 320 | * Peermap of all of our neighbors; processing these usually requires |
321 | * first checking to see if the peer is core-connected and if the | 321 | * first checking to see if the peer is core-connected and if the |
322 | * distance is 1, in which case they are direct neighbors. | 322 | * distance is 1, in which case they are direct neighbors. |
323 | */ | 323 | */ |
324 | static struct GNUNET_CONTAINER_MultiPeerMap *direct_neighbors; | 324 | static struct GNUNET_CONTAINER_MultiPeerMap *direct_neighbors; |
325 | 325 | ||
326 | /** | 326 | /** |
327 | * Hashmap with all routes that we currently support; contains | 327 | * Hashmap with all routes that we currently support; contains |
328 | * routing information for all peers from distance 2 | 328 | * routing information for all peers from distance 2 |
329 | * up to distance DEFAULT_FISHEYE_DEPTH. | 329 | * up to distance DEFAULT_FISHEYE_DEPTH. |
330 | */ | 330 | */ |
@@ -367,7 +367,7 @@ static struct GNUNET_STATISTICS_Handle *stats; | |||
367 | * Handle to ATS service. | 367 | * Handle to ATS service. |
368 | */ | 368 | */ |
369 | static struct GNUNET_ATS_PerformanceHandle *ats; | 369 | static struct GNUNET_ATS_PerformanceHandle *ats; |
370 | 370 | ||
371 | 371 | ||
372 | /** | 372 | /** |
373 | * Start creating a new DV set union by initiating the connection. | 373 | * Start creating a new DV set union by initiating the connection. |
@@ -375,7 +375,7 @@ static struct GNUNET_ATS_PerformanceHandle *ats; | |||
375 | * @param cls the 'struct DirectNeighbor' of the peer we're building | 375 | * @param cls the 'struct DirectNeighbor' of the peer we're building |
376 | * a routing consensus with | 376 | * a routing consensus with |
377 | * @param tc scheduler context | 377 | * @param tc scheduler context |
378 | */ | 378 | */ |
379 | static void | 379 | static void |
380 | initiate_set_union (void *cls, | 380 | initiate_set_union (void *cls, |
381 | const struct GNUNET_SCHEDULER_TaskContext *tc); | 381 | const struct GNUNET_SCHEDULER_TaskContext *tc); |
@@ -396,7 +396,7 @@ initiate_set_union (void *cls, | |||
396 | * necessary to specify the set we want to do the operation with, | 396 | * necessary to specify the set we want to do the operation with, |
397 | * whith sometimes can be derived from the context message. | 397 | * whith sometimes can be derived from the context message. |
398 | * Also necessary to specify the timeout. | 398 | * Also necessary to specify the timeout. |
399 | */ | 399 | */ |
400 | static void | 400 | static void |
401 | listen_set_union (void *cls, | 401 | listen_set_union (void *cls, |
402 | const struct GNUNET_PeerIdentity *other_peer, | 402 | const struct GNUNET_PeerIdentity *other_peer, |
@@ -412,7 +412,7 @@ listen_set_union (void *cls, | |||
412 | * @param distance distance to the original sender of the message | 412 | * @param distance distance to the original sender of the message |
413 | */ | 413 | */ |
414 | static void | 414 | static void |
415 | send_data_to_plugin (const struct GNUNET_MessageHeader *message, | 415 | send_data_to_plugin (const struct GNUNET_MessageHeader *message, |
416 | const struct GNUNET_PeerIdentity *origin, | 416 | const struct GNUNET_PeerIdentity *origin, |
417 | uint32_t distance) | 417 | uint32_t distance) |
418 | { | 418 | { |
@@ -422,10 +422,10 @@ send_data_to_plugin (const struct GNUNET_MessageHeader *message, | |||
422 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 422 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
423 | "Delivering message from peer `%s'\n", | 423 | "Delivering message from peer `%s'\n", |
424 | GNUNET_i2s (origin)); | 424 | GNUNET_i2s (origin)); |
425 | size = sizeof (struct GNUNET_DV_ReceivedMessage) + | 425 | size = sizeof (struct GNUNET_DV_ReceivedMessage) + |
426 | ntohs (message->size); | 426 | ntohs (message->size); |
427 | if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | 427 | if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
428 | { | 428 | { |
429 | GNUNET_break (0); /* too big */ | 429 | GNUNET_break (0); /* too big */ |
430 | return; | 430 | return; |
431 | } | 431 | } |
@@ -435,7 +435,7 @@ send_data_to_plugin (const struct GNUNET_MessageHeader *message, | |||
435 | received_msg->distance = htonl (distance); | 435 | received_msg->distance = htonl (distance); |
436 | received_msg->sender = *origin; | 436 | received_msg->sender = *origin; |
437 | memcpy (&received_msg[1], message, ntohs (message->size)); | 437 | memcpy (&received_msg[1], message, ntohs (message->size)); |
438 | GNUNET_SERVER_notification_context_broadcast (nc, | 438 | GNUNET_SERVER_notification_context_broadcast (nc, |
439 | &received_msg->header, | 439 | &received_msg->header, |
440 | GNUNET_YES); | 440 | GNUNET_YES); |
441 | GNUNET_free (received_msg); | 441 | GNUNET_free (received_msg); |
@@ -450,7 +450,7 @@ send_data_to_plugin (const struct GNUNET_MessageHeader *message, | |||
450 | static void | 450 | static void |
451 | send_control_to_plugin (const struct GNUNET_MessageHeader *message) | 451 | send_control_to_plugin (const struct GNUNET_MessageHeader *message) |
452 | { | 452 | { |
453 | GNUNET_SERVER_notification_context_broadcast (nc, | 453 | GNUNET_SERVER_notification_context_broadcast (nc, |
454 | message, | 454 | message, |
455 | GNUNET_NO); | 455 | GNUNET_NO); |
456 | } | 456 | } |
@@ -464,7 +464,7 @@ send_control_to_plugin (const struct GNUNET_MessageHeader *message) | |||
464 | * @param nack GNUNET_NO to send ACK, GNUNET_YES to send NACK | 464 | * @param nack GNUNET_NO to send ACK, GNUNET_YES to send NACK |
465 | */ | 465 | */ |
466 | static void | 466 | static void |
467 | send_ack_to_plugin (const struct GNUNET_PeerIdentity *target, | 467 | send_ack_to_plugin (const struct GNUNET_PeerIdentity *target, |
468 | uint32_t uid, | 468 | uint32_t uid, |
469 | int nack) | 469 | int nack) |
470 | { | 470 | { |
@@ -474,7 +474,7 @@ send_ack_to_plugin (const struct GNUNET_PeerIdentity *target, | |||
474 | "Delivering ACK for message to peer `%s'\n", | 474 | "Delivering ACK for message to peer `%s'\n", |
475 | GNUNET_i2s (target)); | 475 | GNUNET_i2s (target)); |
476 | ack_msg.header.size = htons (sizeof (ack_msg)); | 476 | ack_msg.header.size = htons (sizeof (ack_msg)); |
477 | ack_msg.header.type = htons ((GNUNET_YES == nack) | 477 | ack_msg.header.type = htons ((GNUNET_YES == nack) |
478 | ? GNUNET_MESSAGE_TYPE_DV_SEND_NACK | 478 | ? GNUNET_MESSAGE_TYPE_DV_SEND_NACK |
479 | : GNUNET_MESSAGE_TYPE_DV_SEND_ACK); | 479 | : GNUNET_MESSAGE_TYPE_DV_SEND_ACK); |
480 | ack_msg.uid = htonl (uid); | 480 | ack_msg.uid = htonl (uid); |
@@ -490,7 +490,7 @@ send_ack_to_plugin (const struct GNUNET_PeerIdentity *target, | |||
490 | * @param distance new distance to the peer | 490 | * @param distance new distance to the peer |
491 | */ | 491 | */ |
492 | static void | 492 | static void |
493 | send_distance_change_to_plugin (const struct GNUNET_PeerIdentity *peer, | 493 | send_distance_change_to_plugin (const struct GNUNET_PeerIdentity *peer, |
494 | uint32_t distance) | 494 | uint32_t distance) |
495 | { | 495 | { |
496 | struct GNUNET_DV_DistanceUpdateMessage du_msg; | 496 | struct GNUNET_DV_DistanceUpdateMessage du_msg; |
@@ -513,7 +513,7 @@ send_distance_change_to_plugin (const struct GNUNET_PeerIdentity *peer, | |||
513 | * @param distance distance to the target | 513 | * @param distance distance to the target |
514 | */ | 514 | */ |
515 | static void | 515 | static void |
516 | send_connect_to_plugin (const struct GNUNET_PeerIdentity *target, | 516 | send_connect_to_plugin (const struct GNUNET_PeerIdentity *target, |
517 | uint32_t distance) | 517 | uint32_t distance) |
518 | { | 518 | { |
519 | struct GNUNET_DV_ConnectMessage cm; | 519 | struct GNUNET_DV_ConnectMessage cm; |
@@ -585,7 +585,7 @@ core_transmit_notify (void *cls, size_t size, void *buf) | |||
585 | dn->pm_tail, | 585 | dn->pm_tail, |
586 | pending); | 586 | pending); |
587 | memcpy (&cbuf[off], pending->msg, msize); | 587 | memcpy (&cbuf[off], pending->msg, msize); |
588 | if (0 != pending->uid) | 588 | if (0 != pending->uid) |
589 | send_ack_to_plugin (&pending->ultimate_target, | 589 | send_ack_to_plugin (&pending->ultimate_target, |
590 | pending->uid, | 590 | pending->uid, |
591 | GNUNET_NO); | 591 | GNUNET_NO); |
@@ -599,7 +599,7 @@ core_transmit_notify (void *cls, size_t size, void *buf) | |||
599 | 0 /* priority */, | 599 | 0 /* priority */, |
600 | GNUNET_TIME_UNIT_FOREVER_REL, | 600 | GNUNET_TIME_UNIT_FOREVER_REL, |
601 | &dn->peer, | 601 | &dn->peer, |
602 | msize, | 602 | msize, |
603 | &core_transmit_notify, dn); | 603 | &core_transmit_notify, dn); |
604 | return off; | 604 | return off; |
605 | } | 605 | } |
@@ -662,7 +662,7 @@ forward_payload (struct DirectNeighbor *target, | |||
662 | 0 /* priority */, | 662 | 0 /* priority */, |
663 | GNUNET_TIME_UNIT_FOREVER_REL, | 663 | GNUNET_TIME_UNIT_FOREVER_REL, |
664 | &target->peer, | 664 | &target->peer, |
665 | msize, | 665 | msize, |
666 | &core_transmit_notify, target); | 666 | &core_transmit_notify, target); |
667 | } | 667 | } |
668 | 668 | ||
@@ -738,7 +738,7 @@ move_route (struct Route *route, | |||
738 | release_route (route); | 738 | release_route (route); |
739 | i = get_consensus_slot (new_distance); | 739 | i = get_consensus_slot (new_distance); |
740 | route->set_offset = i; | 740 | route->set_offset = i; |
741 | consensi[new_distance].targets[i] = route; | 741 | consensi[new_distance].targets[i] = route; |
742 | route->target.distance = htonl (new_distance); | 742 | route->target.distance = htonl (new_distance); |
743 | } | 743 | } |
744 | 744 | ||
@@ -785,13 +785,13 @@ build_set (void *cls) | |||
785 | while ( (DEFAULT_FISHEYE_DEPTH - 1 > neighbor->consensus_insertion_distance) && | 785 | while ( (DEFAULT_FISHEYE_DEPTH - 1 > neighbor->consensus_insertion_distance) && |
786 | (consensi[neighbor->consensus_insertion_distance].array_length < neighbor->consensus_insertion_offset) && | 786 | (consensi[neighbor->consensus_insertion_distance].array_length < neighbor->consensus_insertion_offset) && |
787 | (NULL == consensi[neighbor->consensus_insertion_distance].targets[neighbor->consensus_insertion_offset]) ) | 787 | (NULL == consensi[neighbor->consensus_insertion_distance].targets[neighbor->consensus_insertion_offset]) ) |
788 | neighbor->consensus_insertion_offset++; | 788 | neighbor->consensus_insertion_offset++; |
789 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 789 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
790 | "Adding element to SET\n"); | 790 | "Adding element to SET\n"); |
791 | GNUNET_SET_add_element (neighbor->my_set, | 791 | GNUNET_SET_add_element (neighbor->my_set, |
792 | &element, | 792 | &element, |
793 | &build_set, neighbor); | 793 | &build_set, neighbor); |
794 | 794 | ||
795 | } | 795 | } |
796 | 796 | ||
797 | 797 | ||
@@ -814,9 +814,9 @@ handle_direct_connect (struct DirectNeighbor *neighbor) | |||
814 | GNUNET_STATISTICS_update (stats, | 814 | GNUNET_STATISTICS_update (stats, |
815 | "# peers connected (1-hop)", | 815 | "# peers connected (1-hop)", |
816 | 1, GNUNET_NO); | 816 | 1, GNUNET_NO); |
817 | route = GNUNET_CONTAINER_multipeermap_get (all_routes, | 817 | route = GNUNET_CONTAINER_multipeermap_get (all_routes, |
818 | &neighbor->peer); | 818 | &neighbor->peer); |
819 | if (NULL != route) | 819 | if (NULL != route) |
820 | { | 820 | { |
821 | send_disconnect_to_plugin (&neighbor->peer); | 821 | send_disconnect_to_plugin (&neighbor->peer); |
822 | release_route (route); | 822 | release_route (route); |
@@ -839,7 +839,7 @@ handle_direct_connect (struct DirectNeighbor *neighbor) | |||
839 | sizeof (struct GNUNET_PeerIdentity))) | 839 | sizeof (struct GNUNET_PeerIdentity))) |
840 | { | 840 | { |
841 | neighbor->initiate_task = GNUNET_SCHEDULER_add_now (&initiate_set_union, | 841 | neighbor->initiate_task = GNUNET_SCHEDULER_add_now (&initiate_set_union, |
842 | neighbor); | 842 | neighbor); |
843 | } | 843 | } |
844 | else | 844 | else |
845 | { | 845 | { |
@@ -861,16 +861,16 @@ handle_direct_connect (struct DirectNeighbor *neighbor) | |||
861 | * @param peer peer identity this notification is about | 861 | * @param peer peer identity this notification is about |
862 | */ | 862 | */ |
863 | static void | 863 | static void |
864 | handle_core_connect (void *cls, | 864 | handle_core_connect (void *cls, |
865 | const struct GNUNET_PeerIdentity *peer) | 865 | const struct GNUNET_PeerIdentity *peer) |
866 | { | 866 | { |
867 | struct DirectNeighbor *neighbor; | 867 | struct DirectNeighbor *neighbor; |
868 | 868 | ||
869 | /* Check for connect to self message */ | 869 | /* Check for connect to self message */ |
870 | if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity))) | 870 | if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity))) |
871 | return; | 871 | return; |
872 | /* check if entry exists */ | 872 | /* check if entry exists */ |
873 | neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors, | 873 | neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors, |
874 | peer); | 874 | peer); |
875 | if (NULL != neighbor) | 875 | if (NULL != neighbor) |
876 | { | 876 | { |
@@ -929,14 +929,14 @@ free_targets (void *cls, | |||
929 | * @return GNUNET_YES to continue iteration, GNUNET_NO to stop | 929 | * @return GNUNET_YES to continue iteration, GNUNET_NO to stop |
930 | */ | 930 | */ |
931 | static int | 931 | static int |
932 | check_possible_route (void *cls, | 932 | check_possible_route (void *cls, |
933 | const struct GNUNET_PeerIdentity *key, | 933 | const struct GNUNET_PeerIdentity *key, |
934 | void *value) | 934 | void *value) |
935 | { | 935 | { |
936 | struct DirectNeighbor *neighbor = cls; | 936 | struct DirectNeighbor *neighbor = cls; |
937 | struct Target *target = value; | 937 | struct Target *target = value; |
938 | struct Route *route; | 938 | struct Route *route; |
939 | 939 | ||
940 | route = GNUNET_CONTAINER_multipeermap_get (all_routes, | 940 | route = GNUNET_CONTAINER_multipeermap_get (all_routes, |
941 | key); | 941 | key); |
942 | if (NULL != route) | 942 | if (NULL != route) |
@@ -975,15 +975,15 @@ check_possible_route (void *cls, | |||
975 | * @return GNUNET_YES to continue iteration | 975 | * @return GNUNET_YES to continue iteration |
976 | */ | 976 | */ |
977 | static int | 977 | static int |
978 | refresh_routes (void *cls, | 978 | refresh_routes (void *cls, |
979 | const struct GNUNET_PeerIdentity *key, | 979 | const struct GNUNET_PeerIdentity *key, |
980 | void *value) | 980 | void *value) |
981 | { | 981 | { |
982 | struct DirectNeighbor *neighbor = value; | 982 | struct DirectNeighbor *neighbor = value; |
983 | 983 | ||
984 | if ( (GNUNET_YES != neighbor->connected) || | 984 | if ( (GNUNET_YES != neighbor->connected) || |
985 | (DIRECT_NEIGHBOR_COST != neighbor->distance) ) | 985 | (DIRECT_NEIGHBOR_COST != neighbor->distance) ) |
986 | return GNUNET_YES; | 986 | return GNUNET_YES; |
987 | if (NULL != neighbor->neighbor_table) | 987 | if (NULL != neighbor->neighbor_table) |
988 | GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table, | 988 | GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table, |
989 | &check_possible_route, | 989 | &check_possible_route, |
@@ -1024,8 +1024,8 @@ get_atsi_distance (const struct GNUNET_ATS_Information *atsi, | |||
1024 | * @return GNUNET_YES to continue iteration, GNUNET_NO to stop | 1024 | * @return GNUNET_YES to continue iteration, GNUNET_NO to stop |
1025 | */ | 1025 | */ |
1026 | static int | 1026 | static int |
1027 | cull_routes (void *cls, | 1027 | cull_routes (void *cls, |
1028 | const struct GNUNET_PeerIdentity *key, | 1028 | const struct GNUNET_PeerIdentity *key, |
1029 | void *value) | 1029 | void *value) |
1030 | { | 1030 | { |
1031 | struct DirectNeighbor *neighbor = cls; | 1031 | struct DirectNeighbor *neighbor = cls; |
@@ -1047,7 +1047,7 @@ cull_routes (void *cls, | |||
1047 | * disrupted. Remove all routes via that peer and | 1047 | * disrupted. Remove all routes via that peer and |
1048 | * stop the consensus with it. | 1048 | * stop the consensus with it. |
1049 | * | 1049 | * |
1050 | * @param neighbor peer that was disconnected (or at least is no | 1050 | * @param neighbor peer that was disconnected (or at least is no |
1051 | * longer at distance 1) | 1051 | * longer at distance 1) |
1052 | */ | 1052 | */ |
1053 | static void | 1053 | static void |
@@ -1118,7 +1118,7 @@ handle_ats_update (void *cls, | |||
1118 | int active, | 1118 | int active, |
1119 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 1119 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
1120 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 1120 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
1121 | const struct GNUNET_ATS_Information *ats, | 1121 | const struct GNUNET_ATS_Information *ats, |
1122 | uint32_t ats_count) | 1122 | uint32_t ats_count) |
1123 | { | 1123 | { |
1124 | struct DirectNeighbor *neighbor; | 1124 | struct DirectNeighbor *neighbor; |
@@ -1126,25 +1126,25 @@ handle_ats_update (void *cls, | |||
1126 | 1126 | ||
1127 | if (GNUNET_NO == active) | 1127 | if (GNUNET_NO == active) |
1128 | return; | 1128 | return; |
1129 | distance = get_atsi_distance (ats, ats_count); | 1129 | distance = get_atsi_distance (ats, ats_count); |
1130 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1130 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1131 | "ATS says distance to %s is %u\n", | 1131 | "ATS says distance to %s is %u\n", |
1132 | GNUNET_i2s (&address->peer), | 1132 | GNUNET_i2s (&address->peer), |
1133 | (unsigned int) distance); | 1133 | (unsigned int) distance); |
1134 | /* check if entry exists */ | 1134 | /* check if entry exists */ |
1135 | neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors, | 1135 | neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors, |
1136 | &address->peer); | 1136 | &address->peer); |
1137 | if (NULL != neighbor) | 1137 | if (NULL != neighbor) |
1138 | { | 1138 | { |
1139 | if ( (DIRECT_NEIGHBOR_COST == neighbor->distance) && | 1139 | if ( (DIRECT_NEIGHBOR_COST == neighbor->distance) && |
1140 | (DIRECT_NEIGHBOR_COST == distance) ) | 1140 | (DIRECT_NEIGHBOR_COST == distance) ) |
1141 | return; /* no change */ | 1141 | return; /* no change */ |
1142 | if (DIRECT_NEIGHBOR_COST == neighbor->distance) | 1142 | if (DIRECT_NEIGHBOR_COST == neighbor->distance) |
1143 | { | 1143 | { |
1144 | neighbor->distance = distance; | 1144 | neighbor->distance = distance; |
1145 | GNUNET_STATISTICS_update (stats, | 1145 | GNUNET_STATISTICS_update (stats, |
1146 | "# peers connected (1-hop)", | 1146 | "# peers connected (1-hop)", |
1147 | -1, GNUNET_NO); | 1147 | -1, GNUNET_NO); |
1148 | handle_direct_disconnect (neighbor); | 1148 | handle_direct_disconnect (neighbor); |
1149 | GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors, | 1149 | GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors, |
1150 | &refresh_routes, | 1150 | &refresh_routes, |
@@ -1153,7 +1153,7 @@ handle_ats_update (void *cls, | |||
1153 | } | 1153 | } |
1154 | neighbor->distance = distance; | 1154 | neighbor->distance = distance; |
1155 | if (DIRECT_NEIGHBOR_COST != neighbor->distance) | 1155 | if (DIRECT_NEIGHBOR_COST != neighbor->distance) |
1156 | return; | 1156 | return; |
1157 | if (GNUNET_YES != neighbor->connected) | 1157 | if (GNUNET_YES != neighbor->connected) |
1158 | return; | 1158 | return; |
1159 | handle_direct_connect (neighbor); | 1159 | handle_direct_connect (neighbor); |
@@ -1167,7 +1167,7 @@ handle_ats_update (void *cls, | |||
1167 | neighbor, | 1167 | neighbor, |
1168 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 1168 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
1169 | neighbor->connected = GNUNET_NO; /* not yet */ | 1169 | neighbor->connected = GNUNET_NO; /* not yet */ |
1170 | neighbor->distance = distance; | 1170 | neighbor->distance = distance; |
1171 | } | 1171 | } |
1172 | 1172 | ||
1173 | 1173 | ||
@@ -1357,7 +1357,7 @@ handle_set_union_result (void *cls, | |||
1357 | /* check if we got an alternative for the removed routes */ | 1357 | /* check if we got an alternative for the removed routes */ |
1358 | GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors, | 1358 | GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors, |
1359 | &refresh_routes, | 1359 | &refresh_routes, |
1360 | NULL); | 1360 | NULL); |
1361 | } | 1361 | } |
1362 | /* add targets that appeared (and check for improved routes) */ | 1362 | /* add targets that appeared (and check for improved routes) */ |
1363 | GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table_consensus, | 1363 | GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table_consensus, |
@@ -1406,7 +1406,7 @@ handle_set_union_result (void *cls, | |||
1406 | * necessary to specify the set we want to do the operation with, | 1406 | * necessary to specify the set we want to do the operation with, |
1407 | * whith sometimes can be derived from the context message. | 1407 | * whith sometimes can be derived from the context message. |
1408 | * Also necessary to specify the timeout. | 1408 | * Also necessary to specify the timeout. |
1409 | */ | 1409 | */ |
1410 | static void | 1410 | static void |
1411 | listen_set_union (void *cls, | 1411 | listen_set_union (void *cls, |
1412 | const struct GNUNET_PeerIdentity *other_peer, | 1412 | const struct GNUNET_PeerIdentity *other_peer, |
@@ -1446,7 +1446,7 @@ listen_set_union (void *cls, | |||
1446 | * @param cls the 'struct DirectNeighbor' of the peer we're building | 1446 | * @param cls the 'struct DirectNeighbor' of the peer we're building |
1447 | * a routing consensus with | 1447 | * a routing consensus with |
1448 | * @param tc scheduler context | 1448 | * @param tc scheduler context |
1449 | */ | 1449 | */ |
1450 | static void | 1450 | static void |
1451 | initiate_set_union (void *cls, | 1451 | initiate_set_union (void *cls, |
1452 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 1452 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
@@ -1550,7 +1550,7 @@ handle_dv_route_message (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1550 | &rm->target, | 1550 | &rm->target, |
1551 | &rm->sender, | 1551 | &rm->sender, |
1552 | payload); | 1552 | payload); |
1553 | return GNUNET_OK; | 1553 | return GNUNET_OK; |
1554 | } | 1554 | } |
1555 | 1555 | ||
1556 | 1556 | ||
@@ -1627,12 +1627,12 @@ cleanup_neighbor (struct DirectNeighbor *neighbor) | |||
1627 | neighbor->pm_queue_size--; | 1627 | neighbor->pm_queue_size--; |
1628 | GNUNET_CONTAINER_DLL_remove (neighbor->pm_head, | 1628 | GNUNET_CONTAINER_DLL_remove (neighbor->pm_head, |
1629 | neighbor->pm_tail, | 1629 | neighbor->pm_tail, |
1630 | pending); | 1630 | pending); |
1631 | GNUNET_free (pending); | 1631 | GNUNET_free (pending); |
1632 | } | 1632 | } |
1633 | handle_direct_disconnect (neighbor); | 1633 | handle_direct_disconnect (neighbor); |
1634 | GNUNET_assert (GNUNET_YES == | 1634 | GNUNET_assert (GNUNET_YES == |
1635 | GNUNET_CONTAINER_multipeermap_remove (direct_neighbors, | 1635 | GNUNET_CONTAINER_multipeermap_remove (direct_neighbors, |
1636 | &neighbor->peer, | 1636 | &neighbor->peer, |
1637 | neighbor)); | 1637 | neighbor)); |
1638 | GNUNET_free (neighbor); | 1638 | GNUNET_free (neighbor); |
@@ -1669,7 +1669,7 @@ handle_core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
1669 | { | 1669 | { |
1670 | GNUNET_STATISTICS_update (stats, | 1670 | GNUNET_STATISTICS_update (stats, |
1671 | "# peers connected (1-hop)", | 1671 | "# peers connected (1-hop)", |
1672 | -1, GNUNET_NO); | 1672 | -1, GNUNET_NO); |
1673 | } | 1673 | } |
1674 | cleanup_neighbor (neighbor); | 1674 | cleanup_neighbor (neighbor); |
1675 | GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors, | 1675 | GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors, |
@@ -1770,13 +1770,13 @@ add_route (void *cls, | |||
1770 | struct GNUNET_SERVER_Client *client = cls; | 1770 | struct GNUNET_SERVER_Client *client = cls; |
1771 | struct Route *route = value; | 1771 | struct Route *route = value; |
1772 | struct GNUNET_DV_ConnectMessage cm; | 1772 | struct GNUNET_DV_ConnectMessage cm; |
1773 | 1773 | ||
1774 | cm.header.size = htons (sizeof (cm)); | 1774 | cm.header.size = htons (sizeof (cm)); |
1775 | cm.header.type = htons (GNUNET_MESSAGE_TYPE_DV_CONNECT); | 1775 | cm.header.type = htons (GNUNET_MESSAGE_TYPE_DV_CONNECT); |
1776 | cm.distance = htonl (route->target.distance); | 1776 | cm.distance = htonl (route->target.distance); |
1777 | cm.peer = route->target.peer; | 1777 | cm.peer = route->target.peer; |
1778 | 1778 | ||
1779 | GNUNET_SERVER_notification_context_unicast (nc, | 1779 | GNUNET_SERVER_notification_context_unicast (nc, |
1780 | client, | 1780 | client, |
1781 | &cm.header, | 1781 | &cm.header, |
1782 | GNUNET_NO); | 1782 | GNUNET_NO); |
@@ -1796,7 +1796,7 @@ static void | |||
1796 | handle_start (void *cls, struct GNUNET_SERVER_Client *client, | 1796 | handle_start (void *cls, struct GNUNET_SERVER_Client *client, |
1797 | const struct GNUNET_MessageHeader *message) | 1797 | const struct GNUNET_MessageHeader *message) |
1798 | { | 1798 | { |
1799 | GNUNET_SERVER_notification_context_add (nc, client); | 1799 | GNUNET_SERVER_notification_context_add (nc, client); |
1800 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 1800 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
1801 | GNUNET_CONTAINER_multipeermap_iterate (all_routes, | 1801 | GNUNET_CONTAINER_multipeermap_iterate (all_routes, |
1802 | &add_route, | 1802 | &add_route, |
@@ -1837,11 +1837,11 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1837 | {NULL, 0, 0} | 1837 | {NULL, 0, 0} |
1838 | }; | 1838 | }; |
1839 | static struct GNUNET_SERVER_MessageHandler plugin_handlers[] = { | 1839 | static struct GNUNET_SERVER_MessageHandler plugin_handlers[] = { |
1840 | {&handle_start, NULL, | 1840 | {&handle_start, NULL, |
1841 | GNUNET_MESSAGE_TYPE_DV_START, | 1841 | GNUNET_MESSAGE_TYPE_DV_START, |
1842 | sizeof (struct GNUNET_MessageHeader) }, | 1842 | sizeof (struct GNUNET_MessageHeader) }, |
1843 | { &handle_dv_send_message, NULL, | 1843 | { &handle_dv_send_message, NULL, |
1844 | GNUNET_MESSAGE_TYPE_DV_SEND, | 1844 | GNUNET_MESSAGE_TYPE_DV_SEND, |
1845 | 0}, | 1845 | 0}, |
1846 | {NULL, NULL, 0, 0} | 1846 | {NULL, NULL, 0, 0} |
1847 | }; | 1847 | }; |
@@ -1850,11 +1850,11 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1850 | direct_neighbors = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); | 1850 | direct_neighbors = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); |
1851 | all_routes = GNUNET_CONTAINER_multipeermap_create (65536, GNUNET_NO); | 1851 | all_routes = GNUNET_CONTAINER_multipeermap_create (65536, GNUNET_NO); |
1852 | core_api = GNUNET_CORE_connect (cfg, NULL, | 1852 | core_api = GNUNET_CORE_connect (cfg, NULL, |
1853 | &core_init, | 1853 | &core_init, |
1854 | &handle_core_connect, | 1854 | &handle_core_connect, |
1855 | &handle_core_disconnect, | 1855 | &handle_core_disconnect, |
1856 | NULL, GNUNET_NO, | 1856 | NULL, GNUNET_NO, |
1857 | NULL, GNUNET_NO, | 1857 | NULL, GNUNET_NO, |
1858 | core_handlers); | 1858 | core_handlers); |
1859 | 1859 | ||
1860 | if (NULL == core_api) | 1860 | if (NULL == core_api) |
diff --git a/src/dv/plugin_transport_dv.c b/src/dv/plugin_transport_dv.c index 76c823b17..2acc3da3f 100644 --- a/src/dv/plugin_transport_dv.c +++ b/src/dv/plugin_transport_dv.c | |||
@@ -160,7 +160,7 @@ struct Plugin | |||
160 | /** | 160 | /** |
161 | * Tokenizer for boxed messages. | 161 | * Tokenizer for boxed messages. |
162 | */ | 162 | */ |
163 | struct GNUNET_SERVER_MessageStreamTokenizer *mst; | 163 | struct GNUNET_SERVER_MessageStreamTokenizer *mst; |
164 | 164 | ||
165 | }; | 165 | }; |
166 | 166 | ||
@@ -202,11 +202,11 @@ unbox_cb (void *cls, | |||
202 | struct Plugin *plugin = cls; | 202 | struct Plugin *plugin = cls; |
203 | struct Session *session = client; | 203 | struct Session *session = client; |
204 | struct GNUNET_ATS_Information ats; | 204 | struct GNUNET_ATS_Information ats; |
205 | 205 | ||
206 | ats.type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); | 206 | ats.type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); |
207 | ats.value = htonl (session->distance); | 207 | ats.value = htonl (session->distance); |
208 | session->active = GNUNET_YES; | 208 | session->active = GNUNET_YES; |
209 | plugin->env->receive (plugin->env->cls, | 209 | plugin->env->receive (plugin->env->cls, |
210 | &session->sender, | 210 | &session->sender, |
211 | message, | 211 | message, |
212 | session, "", 0); | 212 | session, "", 0); |
@@ -222,7 +222,7 @@ unbox_cb (void *cls, | |||
222 | * @param cls closure with the plugin | 222 | * @param cls closure with the plugin |
223 | * @param sender sender of the message | 223 | * @param sender sender of the message |
224 | * @param distance how far did the message travel | 224 | * @param distance how far did the message travel |
225 | * @param msg actual message payload | 225 | * @param msg actual message payload |
226 | */ | 226 | */ |
227 | static void | 227 | static void |
228 | handle_dv_message_received (void *cls, | 228 | handle_dv_message_received (void *cls, |
@@ -236,7 +236,7 @@ handle_dv_message_received (void *cls, | |||
236 | 236 | ||
237 | session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, | 237 | session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, |
238 | sender); | 238 | sender); |
239 | if (NULL == session) | 239 | if (NULL == session) |
240 | { | 240 | { |
241 | GNUNET_break (0); | 241 | GNUNET_break (0); |
242 | return; | 242 | return; |
@@ -244,7 +244,7 @@ handle_dv_message_received (void *cls, | |||
244 | if (GNUNET_MESSAGE_TYPE_DV_BOX == ntohs (msg->type)) | 244 | if (GNUNET_MESSAGE_TYPE_DV_BOX == ntohs (msg->type)) |
245 | { | 245 | { |
246 | /* need to unbox using MST */ | 246 | /* need to unbox using MST */ |
247 | GNUNET_SERVER_mst_receive (plugin->mst, | 247 | GNUNET_SERVER_mst_receive (plugin->mst, |
248 | session, | 248 | session, |
249 | (const char *) &msg[1], | 249 | (const char *) &msg[1], |
250 | ntohs (msg->size) - sizeof (struct GNUNET_MessageHeader), | 250 | ntohs (msg->size) - sizeof (struct GNUNET_MessageHeader), |
@@ -270,7 +270,7 @@ handle_dv_message_received (void *cls, | |||
270 | * @param peer newly connected peer | 270 | * @param peer newly connected peer |
271 | * @param distance distance to the peer | 271 | * @param distance distance to the peer |
272 | */ | 272 | */ |
273 | static void | 273 | static void |
274 | handle_dv_connect (void *cls, | 274 | handle_dv_connect (void *cls, |
275 | const struct GNUNET_PeerIdentity *peer, | 275 | const struct GNUNET_PeerIdentity *peer, |
276 | uint32_t distance) | 276 | uint32_t distance) |
@@ -280,13 +280,13 @@ handle_dv_connect (void *cls, | |||
280 | 280 | ||
281 | session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, | 281 | session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, |
282 | peer); | 282 | peer); |
283 | if (NULL != session) | 283 | if (NULL != session) |
284 | { | 284 | { |
285 | GNUNET_break (0); | 285 | GNUNET_break (0); |
286 | session->distance = distance; | 286 | session->distance = distance; |
287 | if (GNUNET_YES == session->active) | 287 | if (GNUNET_YES == session->active) |
288 | notify_distance_change (session); | 288 | notify_distance_change (session); |
289 | return; /* nothing to do */ | 289 | return; /* nothing to do */ |
290 | } | 290 | } |
291 | session = GNUNET_new (struct Session); | 291 | session = GNUNET_new (struct Session); |
292 | session->sender = *peer; | 292 | session->sender = *peer; |
@@ -306,7 +306,7 @@ handle_dv_connect (void *cls, | |||
306 | * @param peer connected peer | 306 | * @param peer connected peer |
307 | * @param distance new distance to the peer | 307 | * @param distance new distance to the peer |
308 | */ | 308 | */ |
309 | static void | 309 | static void |
310 | handle_dv_distance_changed (void *cls, | 310 | handle_dv_distance_changed (void *cls, |
311 | const struct GNUNET_PeerIdentity *peer, | 311 | const struct GNUNET_PeerIdentity *peer, |
312 | uint32_t distance) | 312 | uint32_t distance) |
@@ -316,7 +316,7 @@ handle_dv_distance_changed (void *cls, | |||
316 | 316 | ||
317 | session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, | 317 | session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, |
318 | peer); | 318 | peer); |
319 | if (NULL == session) | 319 | if (NULL == session) |
320 | { | 320 | { |
321 | GNUNET_break (0); | 321 | GNUNET_break (0); |
322 | handle_dv_connect (plugin, peer, distance); | 322 | handle_dv_connect (plugin, peer, distance); |
@@ -370,7 +370,7 @@ free_session (struct Session *session) | |||
370 | * @param cls closure with 'struct Plugin' | 370 | * @param cls closure with 'struct Plugin' |
371 | * @param peer peer that disconnected | 371 | * @param peer peer that disconnected |
372 | */ | 372 | */ |
373 | static void | 373 | static void |
374 | handle_dv_disconnect (void *cls, | 374 | handle_dv_disconnect (void *cls, |
375 | const struct GNUNET_PeerIdentity *peer) | 375 | const struct GNUNET_PeerIdentity *peer) |
376 | { | 376 | { |
@@ -379,7 +379,7 @@ handle_dv_disconnect (void *cls, | |||
379 | 379 | ||
380 | session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, | 380 | session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, |
381 | peer); | 381 | peer); |
382 | if (NULL == session) | 382 | if (NULL == session) |
383 | return; /* nothing to do */ | 383 | return; /* nothing to do */ |
384 | free_session (session); | 384 | free_session (session); |
385 | } | 385 | } |
@@ -431,10 +431,10 @@ send_finished (void *cls, | |||
431 | * and does NOT mean that the message was not transmitted (DV) | 431 | * and does NOT mean that the message was not transmitted (DV) |
432 | */ | 432 | */ |
433 | static ssize_t | 433 | static ssize_t |
434 | dv_plugin_send (void *cls, | 434 | dv_plugin_send (void *cls, |
435 | struct Session *session, | 435 | struct Session *session, |
436 | const char *msgbuf, size_t msgbuf_size, unsigned int priority, | 436 | const char *msgbuf, size_t msgbuf_size, unsigned int priority, |
437 | struct GNUNET_TIME_Relative timeout, | 437 | struct GNUNET_TIME_Relative timeout, |
438 | GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) | 438 | GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) |
439 | { | 439 | { |
440 | struct PendingRequest *pr; | 440 | struct PendingRequest *pr; |
@@ -486,8 +486,8 @@ dv_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target) | |||
486 | 486 | ||
487 | session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, | 487 | session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions, |
488 | target); | 488 | target); |
489 | if (NULL == session) | 489 | if (NULL == session) |
490 | return; /* nothing to do */ | 490 | return; /* nothing to do */ |
491 | while (NULL != (pr = session->pr_head)) | 491 | while (NULL != (pr = session->pr_head)) |
492 | { | 492 | { |
493 | GNUNET_CONTAINER_DLL_remove (session->pr_head, | 493 | GNUNET_CONTAINER_DLL_remove (session->pr_head, |
@@ -548,7 +548,7 @@ dv_plugin_address_to_string (void *cls, const void *addr, size_t addrlen) | |||
548 | if (0 != addrlen) | 548 | if (0 != addrlen) |
549 | { | 549 | { |
550 | GNUNET_break (0); /* malformed */ | 550 | GNUNET_break (0); /* malformed */ |
551 | return NULL; | 551 | return NULL; |
552 | } | 552 | } |
553 | return "dv"; | 553 | return "dv"; |
554 | } | 554 | } |
@@ -588,7 +588,7 @@ dv_plugin_check_address (void *cls, const void *addr, size_t addrlen) | |||
588 | * @param address the address | 588 | * @param address the address |
589 | * @return the session if the address is valid, NULL otherwise | 589 | * @return the session if the address is valid, NULL otherwise |
590 | */ | 590 | */ |
591 | static struct Session * | 591 | static struct Session * |
592 | dv_get_session (void *cls, | 592 | dv_get_session (void *cls, |
593 | const struct GNUNET_HELLO_Address *address) | 593 | const struct GNUNET_HELLO_Address *address) |
594 | { | 594 | { |
@@ -618,7 +618,7 @@ dv_get_session (void *cls, | |||
618 | * @param added length of created address | 618 | * @param added length of created address |
619 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 619 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure |
620 | */ | 620 | */ |
621 | static int | 621 | static int |
622 | dv_plugin_string_to_address (void *cls, | 622 | dv_plugin_string_to_address (void *cls, |
623 | const char *addr, | 623 | const char *addr, |
624 | uint16_t addrlen, | 624 | uint16_t addrlen, |
@@ -646,7 +646,7 @@ dv_plugin_string_to_address (void *cls, | |||
646 | * @param session the session | 646 | * @param session the session |
647 | * @return the network type | 647 | * @return the network type |
648 | */ | 648 | */ |
649 | static enum GNUNET_ATS_Network_Type | 649 | static enum GNUNET_ATS_Network_Type |
650 | dv_get_network (void *cls, | 650 | dv_get_network (void *cls, |
651 | struct Session *session) | 651 | struct Session *session) |
652 | { | 652 | { |
@@ -682,7 +682,7 @@ libgnunet_plugin_transport_dv_init (void *cls) | |||
682 | if (NULL == plugin->dvh) | 682 | if (NULL == plugin->dvh) |
683 | { | 683 | { |
684 | GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions); | 684 | GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions); |
685 | GNUNET_SERVER_mst_destroy (plugin->mst); | 685 | GNUNET_SERVER_mst_destroy (plugin->mst); |
686 | GNUNET_free (plugin); | 686 | GNUNET_free (plugin); |
687 | return NULL; | 687 | return NULL; |
688 | } | 688 | } |
@@ -737,7 +737,7 @@ libgnunet_plugin_transport_dv_done (void *cls) | |||
737 | &free_session_iterator, | 737 | &free_session_iterator, |
738 | NULL); | 738 | NULL); |
739 | GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions); | 739 | GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions); |
740 | GNUNET_SERVER_mst_destroy (plugin->mst); | 740 | GNUNET_SERVER_mst_destroy (plugin->mst); |
741 | GNUNET_free (plugin); | 741 | GNUNET_free (plugin); |
742 | GNUNET_free (api); | 742 | GNUNET_free (api); |
743 | return NULL; | 743 | return NULL; |
diff --git a/src/dv/test_transport_blacklist.c b/src/dv/test_transport_blacklist.c index 601544afa..e76964744 100644 --- a/src/dv/test_transport_blacklist.c +++ b/src/dv/test_transport_blacklist.c | |||
@@ -42,7 +42,7 @@ test_connection (void *cls, | |||
42 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Links successful %u / %u failed\n", links_succeeded, links_failed); | 42 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Links successful %u / %u failed\n", links_succeeded, links_failed); |
43 | if ( (4 == num_peers) && (0 == links_failed) ) | 43 | if ( (4 == num_peers) && (0 == links_failed) ) |
44 | { | 44 | { |
45 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 45 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
46 | "Testbed connect peers despite blacklist!\n"); | 46 | "Testbed connect peers despite blacklist!\n"); |
47 | ok = 1; | 47 | ok = 1; |
48 | } | 48 | } |