diff options
Diffstat (limited to 'src/transport/gnunet-service-transport.c')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 366 |
1 files changed, 183 insertions, 183 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index ae88b4f6f..de25666fa 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -78,8 +78,8 @@ | |||
78 | #define MAX_CONNECT_RETRY 3 | 78 | #define MAX_CONNECT_RETRY 3 |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Limit on the number of ready-to-run tasks when validating | 81 | * Limit on the number of ready-to-run tasks when validating |
82 | * HELLOs. If more tasks are ready to run, we will drop | 82 | * HELLOs. If more tasks are ready to run, we will drop |
83 | * HELLOs instead of validating them. | 83 | * HELLOs instead of validating them. |
84 | */ | 84 | */ |
85 | #define MAX_HELLO_LOAD 4 | 85 | #define MAX_HELLO_LOAD 4 |
@@ -206,7 +206,7 @@ struct ForeignAddressList | |||
206 | unsigned int connect_attempts; | 206 | unsigned int connect_attempts; |
207 | 207 | ||
208 | /** | 208 | /** |
209 | * DV distance to this peer (1 if no DV is used). | 209 | * DV distance to this peer (1 if no DV is used). |
210 | * FIXME: need to set this from transport plugins! | 210 | * FIXME: need to set this from transport plugins! |
211 | */ | 211 | */ |
212 | uint32_t distance; | 212 | uint32_t distance; |
@@ -228,7 +228,7 @@ struct ForeignAddressList | |||
228 | * successfully transmit or receive data to a peer via a particular | 228 | * successfully transmit or receive data to a peer via a particular |
229 | * address, we set this to GNUNET_YES. If we later get an error | 229 | * address, we set this to GNUNET_YES. If we later get an error |
230 | * (disconnect notification, transmission failure, timeout), we set | 230 | * (disconnect notification, transmission failure, timeout), we set |
231 | * it back to GNUNET_NO. | 231 | * it back to GNUNET_NO. |
232 | */ | 232 | */ |
233 | int8_t connected; | 233 | int8_t connected; |
234 | 234 | ||
@@ -479,7 +479,7 @@ struct NeighbourList | |||
479 | * Buffer for at most one payload message used when we receive | 479 | * Buffer for at most one payload message used when we receive |
480 | * payload data before our PING-PONG has succeeded. We then | 480 | * payload data before our PING-PONG has succeeded. We then |
481 | * store such messages in this intermediary buffer until the | 481 | * store such messages in this intermediary buffer until the |
482 | * connection is fully up. | 482 | * connection is fully up. |
483 | */ | 483 | */ |
484 | struct GNUNET_MessageHeader *pre_connect_message_buffer; | 484 | struct GNUNET_MessageHeader *pre_connect_message_buffer; |
485 | 485 | ||
@@ -547,7 +547,7 @@ struct NeighbourList | |||
547 | unsigned int quota_violation_count; | 547 | unsigned int quota_violation_count; |
548 | 548 | ||
549 | /** | 549 | /** |
550 | * DV distance to this peer (1 if no DV is used). | 550 | * DV distance to this peer (1 if no DV is used). |
551 | */ | 551 | */ |
552 | uint32_t distance; | 552 | uint32_t distance; |
553 | 553 | ||
@@ -643,7 +643,7 @@ struct TransportPongMessage | |||
643 | 643 | ||
644 | /** | 644 | /** |
645 | * Size of address appended to this message (part of what is | 645 | * Size of address appended to this message (part of what is |
646 | * being signed, hence not redundant). | 646 | * being signed, hence not redundant). |
647 | */ | 647 | */ |
648 | uint32_t addrlen; | 648 | uint32_t addrlen; |
649 | 649 | ||
@@ -698,7 +698,7 @@ struct TransportClient | |||
698 | 698 | ||
699 | /** | 699 | /** |
700 | * Current transmit request handle. | 700 | * Current transmit request handle. |
701 | */ | 701 | */ |
702 | struct GNUNET_CONNECTION_TransmitHandle *th; | 702 | struct GNUNET_CONNECTION_TransmitHandle *th; |
703 | 703 | ||
704 | /** | 704 | /** |
@@ -807,7 +807,7 @@ struct CheckHelloValidatedContext | |||
807 | * NULL after we are done processing peerinfo's information. | 807 | * NULL after we are done processing peerinfo's information. |
808 | */ | 808 | */ |
809 | struct GNUNET_PEERINFO_IteratorContext *piter; | 809 | struct GNUNET_PEERINFO_IteratorContext *piter; |
810 | 810 | ||
811 | /** | 811 | /** |
812 | * Was a HELLO known for this peer to peerinfo? | 812 | * Was a HELLO known for this peer to peerinfo? |
813 | */ | 813 | */ |
@@ -924,7 +924,7 @@ static void try_transmission_to_peer (struct NeighbourList *neighbour); | |||
924 | 924 | ||
925 | /** | 925 | /** |
926 | * Find an entry in the neighbour list for a particular peer. | 926 | * Find an entry in the neighbour list for a particular peer. |
927 | * | 927 | * |
928 | * @return NULL if not found. | 928 | * @return NULL if not found. |
929 | */ | 929 | */ |
930 | static struct NeighbourList * | 930 | static struct NeighbourList * |
@@ -990,11 +990,11 @@ add_peer_to_blacklist (struct GNUNET_PeerIdentity *peer, char *transport_name) | |||
990 | plugin = find_transport(transport_name); | 990 | plugin = find_transport(transport_name); |
991 | if (plugin == NULL) /* Nothing to do */ | 991 | if (plugin == NULL) /* Nothing to do */ |
992 | return; | 992 | return; |
993 | if (plugin->blacklist == NULL) | 993 | if (plugin->blacklist == NULL) |
994 | plugin->blacklist = GNUNET_CONTAINER_multihashmap_create(TRANSPORT_BLACKLIST_HT_SIZE); | 994 | plugin->blacklist = GNUNET_CONTAINER_multihashmap_create(TRANSPORT_BLACKLIST_HT_SIZE); |
995 | GNUNET_assert(plugin->blacklist != NULL); | 995 | GNUNET_assert(plugin->blacklist != NULL); |
996 | GNUNET_CONTAINER_multihashmap_put(plugin->blacklist, &peer->hashPubKey, | 996 | GNUNET_CONTAINER_multihashmap_put(plugin->blacklist, &peer->hashPubKey, |
997 | NULL, | 997 | NULL, |
998 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE); | 998 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE); |
999 | } | 999 | } |
1000 | 1000 | ||
@@ -1196,7 +1196,7 @@ transmit_to_client_callback (void *cls, size_t size, void *buf) | |||
1196 | GNUNET_STATISTICS_update (stats, | 1196 | GNUNET_STATISTICS_update (stats, |
1197 | gettext_noop ("# bytes discarded (could not transmit to client)"), | 1197 | gettext_noop ("# bytes discarded (could not transmit to client)"), |
1198 | ntohs (((const struct GNUNET_MessageHeader*)&q[1])->size), | 1198 | ntohs (((const struct GNUNET_MessageHeader*)&q[1])->size), |
1199 | GNUNET_NO); | 1199 | GNUNET_NO); |
1200 | GNUNET_CONTAINER_DLL_remove (client->message_queue_head, | 1200 | GNUNET_CONTAINER_DLL_remove (client->message_queue_head, |
1201 | client->message_queue_tail, | 1201 | client->message_queue_tail, |
1202 | q); | 1202 | q); |
@@ -1263,7 +1263,7 @@ a2s (const char *plugin, | |||
1263 | return p->api->address_to_string (p->api->cls, | 1263 | return p->api->address_to_string (p->api->cls, |
1264 | addr, | 1264 | addr, |
1265 | addr_len); | 1265 | addr_len); |
1266 | } | 1266 | } |
1267 | 1267 | ||
1268 | 1268 | ||
1269 | /** | 1269 | /** |
@@ -1340,7 +1340,7 @@ transmit_to_client (struct TransportClient *client, | |||
1340 | ("Dropping message of type %u and size %u, have %u messages pending (%u is the soft limit)\n"), | 1340 | ("Dropping message of type %u and size %u, have %u messages pending (%u is the soft limit)\n"), |
1341 | ntohs (msg->type), | 1341 | ntohs (msg->type), |
1342 | ntohs (msg->size), | 1342 | ntohs (msg->size), |
1343 | client->message_count, | 1343 | client->message_count, |
1344 | MAX_PENDING); | 1344 | MAX_PENDING); |
1345 | GNUNET_STATISTICS_update (stats, | 1345 | GNUNET_STATISTICS_update (stats, |
1346 | gettext_noop ("# messages dropped due to slow client"), | 1346 | gettext_noop ("# messages dropped due to slow client"), |
@@ -1355,7 +1355,7 @@ transmit_to_client (struct TransportClient *client, | |||
1355 | GNUNET_CONTAINER_DLL_insert_after (client->message_queue_head, | 1355 | GNUNET_CONTAINER_DLL_insert_after (client->message_queue_head, |
1356 | client->message_queue_tail, | 1356 | client->message_queue_tail, |
1357 | client->message_queue_tail, | 1357 | client->message_queue_tail, |
1358 | q); | 1358 | q); |
1359 | client->message_count++; | 1359 | client->message_count++; |
1360 | if (client->th == NULL) | 1360 | if (client->th == NULL) |
1361 | { | 1361 | { |
@@ -1389,7 +1389,7 @@ transmit_send_ok (struct TransportClient *client, | |||
1389 | send_ok_msg.success = htonl (result); | 1389 | send_ok_msg.success = htonl (result); |
1390 | send_ok_msg.latency = GNUNET_TIME_relative_hton (n->latency); | 1390 | send_ok_msg.latency = GNUNET_TIME_relative_hton (n->latency); |
1391 | send_ok_msg.peer = n->id; | 1391 | send_ok_msg.peer = n->id; |
1392 | transmit_to_client (client, &send_ok_msg.header, GNUNET_NO); | 1392 | transmit_to_client (client, &send_ok_msg.header, GNUNET_NO); |
1393 | } | 1393 | } |
1394 | 1394 | ||
1395 | 1395 | ||
@@ -1414,7 +1414,7 @@ transmit_send_continuation (void *cls, | |||
1414 | { | 1414 | { |
1415 | struct MessageQueue *mq = cls; | 1415 | struct MessageQueue *mq = cls; |
1416 | struct NeighbourList *n; | 1416 | struct NeighbourList *n; |
1417 | 1417 | ||
1418 | GNUNET_STATISTICS_update (stats, | 1418 | GNUNET_STATISTICS_update (stats, |
1419 | gettext_noop ("# bytes pending with plugins"), | 1419 | gettext_noop ("# bytes pending with plugins"), |
1420 | - (int64_t) mq->message_buf_size, | 1420 | - (int64_t) mq->message_buf_size, |
@@ -1424,27 +1424,27 @@ transmit_send_continuation (void *cls, | |||
1424 | GNUNET_STATISTICS_update (stats, | 1424 | GNUNET_STATISTICS_update (stats, |
1425 | gettext_noop ("# bytes successfully transmitted by plugins"), | 1425 | gettext_noop ("# bytes successfully transmitted by plugins"), |
1426 | mq->message_buf_size, | 1426 | mq->message_buf_size, |
1427 | GNUNET_NO); | 1427 | GNUNET_NO); |
1428 | } | 1428 | } |
1429 | else | 1429 | else |
1430 | { | 1430 | { |
1431 | GNUNET_STATISTICS_update (stats, | 1431 | GNUNET_STATISTICS_update (stats, |
1432 | gettext_noop ("# bytes with transmission failure by plugins"), | 1432 | gettext_noop ("# bytes with transmission failure by plugins"), |
1433 | mq->message_buf_size, | 1433 | mq->message_buf_size, |
1434 | GNUNET_NO); | 1434 | GNUNET_NO); |
1435 | } | 1435 | } |
1436 | n = find_neighbour(&mq->neighbour_id); | 1436 | n = find_neighbour(&mq->neighbour_id); |
1437 | GNUNET_assert (n != NULL); | 1437 | GNUNET_assert (n != NULL); |
1438 | if (mq->specific_address != NULL) | 1438 | if (mq->specific_address != NULL) |
1439 | { | 1439 | { |
1440 | if (result == GNUNET_OK) | 1440 | if (result == GNUNET_OK) |
1441 | { | 1441 | { |
1442 | mq->specific_address->timeout = | 1442 | mq->specific_address->timeout = |
1443 | GNUNET_TIME_relative_to_absolute | 1443 | GNUNET_TIME_relative_to_absolute |
1444 | (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | 1444 | (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
1445 | if (mq->specific_address->validated == GNUNET_YES) | 1445 | if (mq->specific_address->validated == GNUNET_YES) |
1446 | mark_address_connected (mq->specific_address); | 1446 | mark_address_connected (mq->specific_address); |
1447 | } | 1447 | } |
1448 | else | 1448 | else |
1449 | { | 1449 | { |
1450 | if (mq->specific_address->connected != GNUNET_NO) | 1450 | if (mq->specific_address->connected != GNUNET_NO) |
@@ -1462,8 +1462,8 @@ transmit_send_continuation (void *cls, | |||
1462 | GNUNET_NO); | 1462 | GNUNET_NO); |
1463 | mq->specific_address->connected = GNUNET_NO; | 1463 | mq->specific_address->connected = GNUNET_NO; |
1464 | } | 1464 | } |
1465 | } | 1465 | } |
1466 | if (! mq->internal_msg) | 1466 | if (! mq->internal_msg) |
1467 | mq->specific_address->in_transmit = GNUNET_NO; | 1467 | mq->specific_address->in_transmit = GNUNET_NO; |
1468 | } | 1468 | } |
1469 | if (mq->client != NULL) | 1469 | if (mq->client != NULL) |
@@ -1496,7 +1496,7 @@ find_ready_address(struct NeighbourList *neighbour) | |||
1496 | addresses = head->addresses; | 1496 | addresses = head->addresses; |
1497 | while (addresses != NULL) | 1497 | while (addresses != NULL) |
1498 | { | 1498 | { |
1499 | if ( (addresses->timeout.value < now.value) && | 1499 | if ( (addresses->timeout.value < now.value) && |
1500 | (addresses->connected == GNUNET_YES) ) | 1500 | (addresses->connected == GNUNET_YES) ) |
1501 | { | 1501 | { |
1502 | #if DEBUG_TRANSPORT | 1502 | #if DEBUG_TRANSPORT |
@@ -1531,13 +1531,13 @@ find_ready_address(struct NeighbourList *neighbour) | |||
1531 | (unsigned long long) addresses->timeout.value, | 1531 | (unsigned long long) addresses->timeout.value, |
1532 | (unsigned int) addresses->distance); | 1532 | (unsigned int) addresses->distance); |
1533 | #endif | 1533 | #endif |
1534 | if ( ( (best_address == NULL) || | 1534 | if ( ( (best_address == NULL) || |
1535 | (addresses->connected == GNUNET_YES) || | 1535 | (addresses->connected == GNUNET_YES) || |
1536 | (best_address->connected == GNUNET_NO) ) && | 1536 | (best_address->connected == GNUNET_NO) ) && |
1537 | (addresses->in_transmit == GNUNET_NO) && | 1537 | (addresses->in_transmit == GNUNET_NO) && |
1538 | ( (best_address == NULL) || | 1538 | ( (best_address == NULL) || |
1539 | (addresses->latency.value < best_address->latency.value)) ) | 1539 | (addresses->latency.value < best_address->latency.value)) ) |
1540 | best_address = addresses; | 1540 | best_address = addresses; |
1541 | /* FIXME: also give lower-latency addresses that are not | 1541 | /* FIXME: also give lower-latency addresses that are not |
1542 | connected a chance some times... */ | 1542 | connected a chance some times... */ |
1543 | addresses = addresses->next; | 1543 | addresses = addresses->next; |
@@ -1549,7 +1549,7 @@ find_ready_address(struct NeighbourList *neighbour) | |||
1549 | #if DEBUG_TRANSPORT | 1549 | #if DEBUG_TRANSPORT |
1550 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1550 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1551 | "Best address found (`%s') has latency of %llu ms.\n", | 1551 | "Best address found (`%s') has latency of %llu ms.\n", |
1552 | (best_address->addrlen > 0) | 1552 | (best_address->addrlen > 0) |
1553 | ? a2s (best_address->ready_list->plugin->short_name, | 1553 | ? a2s (best_address->ready_list->plugin->short_name, |
1554 | best_address->addr, | 1554 | best_address->addr, |
1555 | best_address->addrlen) | 1555 | best_address->addrlen) |
@@ -1613,11 +1613,11 @@ try_transmission_to_peer (struct NeighbourList *neighbour) | |||
1613 | force_address = GNUNET_YES; | 1613 | force_address = GNUNET_YES; |
1614 | if (mq->specific_address == NULL) | 1614 | if (mq->specific_address == NULL) |
1615 | { | 1615 | { |
1616 | mq->specific_address = find_ready_address(neighbour); | 1616 | mq->specific_address = find_ready_address(neighbour); |
1617 | GNUNET_STATISTICS_update (stats, | 1617 | GNUNET_STATISTICS_update (stats, |
1618 | gettext_noop ("# transport selected peer address freely"), | 1618 | gettext_noop ("# transport selected peer address freely"), |
1619 | 1, | 1619 | 1, |
1620 | GNUNET_NO); | 1620 | GNUNET_NO); |
1621 | force_address = GNUNET_NO; | 1621 | force_address = GNUNET_NO; |
1622 | } | 1622 | } |
1623 | if (mq->specific_address == NULL) | 1623 | if (mq->specific_address == NULL) |
@@ -1625,7 +1625,7 @@ try_transmission_to_peer (struct NeighbourList *neighbour) | |||
1625 | GNUNET_STATISTICS_update (stats, | 1625 | GNUNET_STATISTICS_update (stats, |
1626 | gettext_noop ("# transport failed to selected peer address"), | 1626 | gettext_noop ("# transport failed to selected peer address"), |
1627 | 1, | 1627 | 1, |
1628 | GNUNET_NO); | 1628 | GNUNET_NO); |
1629 | timeout = GNUNET_TIME_absolute_get_remaining (mq->timeout); | 1629 | timeout = GNUNET_TIME_absolute_get_remaining (mq->timeout); |
1630 | if (timeout.value == 0) | 1630 | if (timeout.value == 0) |
1631 | { | 1631 | { |
@@ -1642,14 +1642,14 @@ try_transmission_to_peer (struct NeighbourList *neighbour) | |||
1642 | GNUNET_STATISTICS_update (stats, | 1642 | GNUNET_STATISTICS_update (stats, |
1643 | gettext_noop ("# bytes discarded (no destination address available)"), | 1643 | gettext_noop ("# bytes discarded (no destination address available)"), |
1644 | mq->message_buf_size, | 1644 | mq->message_buf_size, |
1645 | GNUNET_NO); | 1645 | GNUNET_NO); |
1646 | if (mq->client != NULL) | 1646 | if (mq->client != NULL) |
1647 | transmit_send_ok (mq->client, neighbour, GNUNET_NO); | 1647 | transmit_send_ok (mq->client, neighbour, GNUNET_NO); |
1648 | GNUNET_CONTAINER_DLL_remove (neighbour->messages_head, | 1648 | GNUNET_CONTAINER_DLL_remove (neighbour->messages_head, |
1649 | neighbour->messages_tail, | 1649 | neighbour->messages_tail, |
1650 | mq); | 1650 | mq); |
1651 | GNUNET_free (mq); | 1651 | GNUNET_free (mq); |
1652 | return; /* nobody ready */ | 1652 | return; /* nobody ready */ |
1653 | } | 1653 | } |
1654 | GNUNET_STATISTICS_update (stats, | 1654 | GNUNET_STATISTICS_update (stats, |
1655 | gettext_noop ("# message delivery deferred (no address)"), | 1655 | gettext_noop ("# message delivery deferred (no address)"), |
@@ -1671,7 +1671,7 @@ try_transmission_to_peer (struct NeighbourList *neighbour) | |||
1671 | #endif | 1671 | #endif |
1672 | /* FIXME: might want to trigger peerinfo lookup here | 1672 | /* FIXME: might want to trigger peerinfo lookup here |
1673 | (unless that's already pending...) */ | 1673 | (unless that's already pending...) */ |
1674 | return; | 1674 | return; |
1675 | } | 1675 | } |
1676 | GNUNET_CONTAINER_DLL_remove (neighbour->messages_head, | 1676 | GNUNET_CONTAINER_DLL_remove (neighbour->messages_head, |
1677 | neighbour->messages_tail, | 1677 | neighbour->messages_tail, |
@@ -1686,7 +1686,7 @@ try_transmission_to_peer (struct NeighbourList *neighbour) | |||
1686 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1686 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1687 | "Sending message of size %u for `%4s' to `%s' via plugin `%s'\n", | 1687 | "Sending message of size %u for `%4s' to `%s' via plugin `%s'\n", |
1688 | mq->message_buf_size, | 1688 | mq->message_buf_size, |
1689 | GNUNET_i2s (&neighbour->id), | 1689 | GNUNET_i2s (&neighbour->id), |
1690 | (mq->specific_address->addr != NULL) | 1690 | (mq->specific_address->addr != NULL) |
1691 | ? a2s (mq->plugin->short_name, | 1691 | ? a2s (mq->plugin->short_name, |
1692 | mq->specific_address->addr, | 1692 | mq->specific_address->addr, |
@@ -1717,7 +1717,7 @@ try_transmission_to_peer (struct NeighbourList *neighbour) | |||
1717 | { | 1717 | { |
1718 | /* failure, but 'send' would not call continuation in this case, | 1718 | /* failure, but 'send' would not call continuation in this case, |
1719 | so we need to do it here! */ | 1719 | so we need to do it here! */ |
1720 | transmit_send_continuation (mq, | 1720 | transmit_send_continuation (mq, |
1721 | &mq->neighbour_id, | 1721 | &mq->neighbour_id, |
1722 | GNUNET_SYSERR); | 1722 | GNUNET_SYSERR); |
1723 | } | 1723 | } |
@@ -1781,7 +1781,7 @@ transmit_to_peer (struct TransportClient *client, | |||
1781 | mq->internal_msg = is_internal; | 1781 | mq->internal_msg = is_internal; |
1782 | mq->priority = priority; | 1782 | mq->priority = priority; |
1783 | mq->timeout = GNUNET_TIME_relative_to_absolute (timeout); | 1783 | mq->timeout = GNUNET_TIME_relative_to_absolute (timeout); |
1784 | if (is_internal) | 1784 | if (is_internal) |
1785 | GNUNET_CONTAINER_DLL_insert (neighbour->messages_head, | 1785 | GNUNET_CONTAINER_DLL_insert (neighbour->messages_head, |
1786 | neighbour->messages_tail, | 1786 | neighbour->messages_tail, |
1787 | mq); | 1787 | mq); |
@@ -1883,7 +1883,7 @@ refresh_hello () | |||
1883 | GNUNET_NO); | 1883 | GNUNET_NO); |
1884 | transmit_to_peer (NULL, NULL, 0, | 1884 | transmit_to_peer (NULL, NULL, 0, |
1885 | HELLO_ADDRESS_EXPIRATION, | 1885 | HELLO_ADDRESS_EXPIRATION, |
1886 | (const char *) our_hello, | 1886 | (const char *) our_hello, |
1887 | GNUNET_HELLO_size(our_hello), | 1887 | GNUNET_HELLO_size(our_hello), |
1888 | GNUNET_NO, npos); | 1888 | GNUNET_NO, npos); |
1889 | npos = npos->next; | 1889 | npos = npos->next; |
@@ -1940,7 +1940,7 @@ update_addresses (struct TransportPlugin *plugin, int fresh) | |||
1940 | if (prev == NULL) | 1940 | if (prev == NULL) |
1941 | plugin->addresses = pos->next; | 1941 | plugin->addresses = pos->next; |
1942 | else | 1942 | else |
1943 | prev->next = pos->next; | 1943 | prev->next = pos->next; |
1944 | GNUNET_free (pos); | 1944 | GNUNET_free (pos); |
1945 | } | 1945 | } |
1946 | else | 1946 | else |
@@ -1994,7 +1994,7 @@ expire_address_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1994 | * @param value value in the hash map ('struct ValidationEntry*') | 1994 | * @param value value in the hash map ('struct ValidationEntry*') |
1995 | * @return GNUNET_YES (we should continue to iterate) | 1995 | * @return GNUNET_YES (we should continue to iterate) |
1996 | */ | 1996 | */ |
1997 | static int | 1997 | static int |
1998 | remove_session_validations (void *cls, | 1998 | remove_session_validations (void *cls, |
1999 | const GNUNET_HashCode * key, | 1999 | const GNUNET_HashCode * key, |
2000 | void *value) | 2000 | void *value) |
@@ -2010,7 +2010,7 @@ remove_session_validations (void *cls, | |||
2010 | 2010 | ||
2011 | /** | 2011 | /** |
2012 | * We've been disconnected from the other peer (for some | 2012 | * We've been disconnected from the other peer (for some |
2013 | * connection-oriented transport). Either quickly | 2013 | * connection-oriented transport). Either quickly |
2014 | * re-establish the connection or signal the disconnect | 2014 | * re-establish the connection or signal the disconnect |
2015 | * to the CORE. | 2015 | * to the CORE. |
2016 | * | 2016 | * |
@@ -2036,7 +2036,7 @@ try_fast_reconnect (struct TransportPlugin *p, | |||
2036 | 1) ideally: our own willingness / need to connect | 2036 | 1) ideally: our own willingness / need to connect |
2037 | 2) prior failures to connect to this peer (by plugin) | 2037 | 2) prior failures to connect to this peer (by plugin) |
2038 | 3) ideally: reasons why other peer terminated (as far as knowable) | 2038 | 3) ideally: reasons why other peer terminated (as far as knowable) |
2039 | 2039 | ||
2040 | Most importantly, it must be POSSIBLE for another peer to terminate | 2040 | Most importantly, it must be POSSIBLE for another peer to terminate |
2041 | a connection for a while (without us instantly re-establishing it). | 2041 | a connection for a while (without us instantly re-establishing it). |
2042 | Similarly, if another peer is gone we should quickly notify CORE. | 2042 | Similarly, if another peer is gone we should quickly notify CORE. |
@@ -2044,7 +2044,7 @@ try_fast_reconnect (struct TransportPlugin *p, | |||
2044 | on the other end), we should reconnect in such a way that BOTH CORE | 2044 | on the other end), we should reconnect in such a way that BOTH CORE |
2045 | services never even notice. | 2045 | services never even notice. |
2046 | Furthermore, the same mechanism (or small variation) could be used | 2046 | Furthermore, the same mechanism (or small variation) could be used |
2047 | to switch to a better-performing plugin (ATS). | 2047 | to switch to a better-performing plugin (ATS). |
2048 | 2048 | ||
2049 | Finally, this needs to be tested throughly... */ | 2049 | Finally, this needs to be tested throughly... */ |
2050 | 2050 | ||
@@ -2071,9 +2071,9 @@ try_fast_reconnect (struct TransportPlugin *p, | |||
2071 | * discard all of those sessions as well. Plugins that do not | 2071 | * discard all of those sessions as well. Plugins that do not |
2072 | * use sessions can simply omit calling this function and always | 2072 | * use sessions can simply omit calling this function and always |
2073 | * use NULL wherever a session pointer is needed. | 2073 | * use NULL wherever a session pointer is needed. |
2074 | * | 2074 | * |
2075 | * @param cls closure | 2075 | * @param cls closure |
2076 | * @param peer which peer was the session for | 2076 | * @param peer which peer was the session for |
2077 | * @param session which session is being destoyed | 2077 | * @param session which session is being destoyed |
2078 | */ | 2078 | */ |
2079 | static void | 2079 | static void |
@@ -2336,7 +2336,7 @@ static struct ForeignAddressList * | |||
2336 | add_peer_address (struct NeighbourList *neighbour, | 2336 | add_peer_address (struct NeighbourList *neighbour, |
2337 | const char *tname, | 2337 | const char *tname, |
2338 | struct Session *session, | 2338 | struct Session *session, |
2339 | const char *addr, | 2339 | const char *addr, |
2340 | uint16_t addrlen) | 2340 | uint16_t addrlen) |
2341 | { | 2341 | { |
2342 | struct ReadyList *head; | 2342 | struct ReadyList *head; |
@@ -2372,7 +2372,7 @@ add_peer_address (struct NeighbourList *neighbour, | |||
2372 | ret->latency = GNUNET_TIME_relative_get_forever(); | 2372 | ret->latency = GNUNET_TIME_relative_get_forever(); |
2373 | ret->distance = -1; | 2373 | ret->distance = -1; |
2374 | ret->timeout = GNUNET_TIME_relative_to_absolute | 2374 | ret->timeout = GNUNET_TIME_relative_to_absolute |
2375 | (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | 2375 | (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
2376 | ret->ready_list = head; | 2376 | ret->ready_list = head; |
2377 | ret->next = head->addresses; | 2377 | ret->next = head->addresses; |
2378 | head->addresses = ret; | 2378 | head->addresses = ret; |
@@ -2510,7 +2510,7 @@ check_address_exists (void *cls, | |||
2510 | * @param value value in the hash map (validation to abort) | 2510 | * @param value value in the hash map (validation to abort) |
2511 | * @return GNUNET_YES (always) | 2511 | * @return GNUNET_YES (always) |
2512 | */ | 2512 | */ |
2513 | static int | 2513 | static int |
2514 | abort_validation (void *cls, | 2514 | abort_validation (void *cls, |
2515 | const GNUNET_HashCode * key, | 2515 | const GNUNET_HashCode * key, |
2516 | void *value) | 2516 | void *value) |
@@ -2620,7 +2620,7 @@ add_to_foreign_address_list (void *cls, | |||
2620 | GNUNET_STATISTICS_update (stats, | 2620 | GNUNET_STATISTICS_update (stats, |
2621 | gettext_noop ("# valid peer addresses returned by PEERINFO"), | 2621 | gettext_noop ("# valid peer addresses returned by PEERINFO"), |
2622 | 1, | 2622 | 1, |
2623 | GNUNET_NO); | 2623 | GNUNET_NO); |
2624 | try = GNUNET_NO; | 2624 | try = GNUNET_NO; |
2625 | fal = find_peer_address (n, tname, NULL, addr, addrlen); | 2625 | fal = find_peer_address (n, tname, NULL, addr, addrlen); |
2626 | if (fal == NULL) | 2626 | if (fal == NULL) |
@@ -2639,7 +2639,7 @@ add_to_foreign_address_list (void *cls, | |||
2639 | GNUNET_STATISTICS_update (stats, | 2639 | GNUNET_STATISTICS_update (stats, |
2640 | gettext_noop ("# previously validated addresses lacking transport"), | 2640 | gettext_noop ("# previously validated addresses lacking transport"), |
2641 | 1, | 2641 | 1, |
2642 | GNUNET_NO); | 2642 | GNUNET_NO); |
2643 | } | 2643 | } |
2644 | else | 2644 | else |
2645 | { | 2645 | { |
@@ -2663,11 +2663,11 @@ add_to_foreign_address_list (void *cls, | |||
2663 | } | 2663 | } |
2664 | if (fal->validated == GNUNET_NO) | 2664 | if (fal->validated == GNUNET_NO) |
2665 | { | 2665 | { |
2666 | fal->validated = GNUNET_YES; | 2666 | fal->validated = GNUNET_YES; |
2667 | GNUNET_STATISTICS_update (stats, | 2667 | GNUNET_STATISTICS_update (stats, |
2668 | gettext_noop ("# peer addresses considered valid"), | 2668 | gettext_noop ("# peer addresses considered valid"), |
2669 | 1, | 2669 | 1, |
2670 | GNUNET_NO); | 2670 | GNUNET_NO); |
2671 | } | 2671 | } |
2672 | if (try == GNUNET_YES) | 2672 | if (try == GNUNET_YES) |
2673 | { | 2673 | { |
@@ -2702,7 +2702,7 @@ add_hello_for_peer (void *cls, | |||
2702 | GNUNET_NO); | 2702 | GNUNET_NO); |
2703 | n->piter = NULL; | 2703 | n->piter = NULL; |
2704 | return; | 2704 | return; |
2705 | } | 2705 | } |
2706 | if (h == NULL) | 2706 | if (h == NULL) |
2707 | return; /* no HELLO available */ | 2707 | return; /* no HELLO available */ |
2708 | #if DEBUG_TRANSPORT | 2708 | #if DEBUG_TRANSPORT |
@@ -2725,7 +2725,7 @@ add_hello_for_peer (void *cls, | |||
2725 | 2725 | ||
2726 | /** | 2726 | /** |
2727 | * Create a fresh entry in our neighbour list for the given peer. | 2727 | * Create a fresh entry in our neighbour list for the given peer. |
2728 | * Will try to transmit our current HELLO to the new neighbour. | 2728 | * Will try to transmit our current HELLO to the new neighbour. |
2729 | * Do not call this function directly, use 'setup_peer_check_blacklist. | 2729 | * Do not call this function directly, use 'setup_peer_check_blacklist. |
2730 | * | 2730 | * |
2731 | * @param peer the peer for which we create the entry | 2731 | * @param peer the peer for which we create the entry |
@@ -2803,7 +2803,7 @@ setup_new_neighbour (const struct GNUNET_PeerIdentity *peer, | |||
2803 | 2803 | ||
2804 | /** | 2804 | /** |
2805 | * Function called after we have checked if communicating | 2805 | * Function called after we have checked if communicating |
2806 | * with a given peer is acceptable. | 2806 | * with a given peer is acceptable. |
2807 | * | 2807 | * |
2808 | * @param cls closure | 2808 | * @param cls closure |
2809 | * @param n NULL if communication is not acceptable | 2809 | * @param n NULL if communication is not acceptable |
@@ -2857,12 +2857,12 @@ static struct Blacklisters *bl_tail; | |||
2857 | */ | 2857 | */ |
2858 | struct BlacklistCheck | 2858 | struct BlacklistCheck |
2859 | { | 2859 | { |
2860 | 2860 | ||
2861 | /** | 2861 | /** |
2862 | * This is a linked list. | 2862 | * This is a linked list. |
2863 | */ | 2863 | */ |
2864 | struct BlacklistCheck *next; | 2864 | struct BlacklistCheck *next; |
2865 | 2865 | ||
2866 | /** | 2866 | /** |
2867 | * This is a linked list. | 2867 | * This is a linked list. |
2868 | */ | 2868 | */ |
@@ -2921,7 +2921,7 @@ static struct BlacklistCheck *bc_tail; | |||
2921 | * Perform next action in the blacklist check. | 2921 | * Perform next action in the blacklist check. |
2922 | * | 2922 | * |
2923 | * @param cls the 'struct BlacklistCheck*' | 2923 | * @param cls the 'struct BlacklistCheck*' |
2924 | * @param tc unused | 2924 | * @param tc unused |
2925 | */ | 2925 | */ |
2926 | static void | 2926 | static void |
2927 | do_blacklist_check (void *cls, | 2927 | do_blacklist_check (void *cls, |
@@ -2959,7 +2959,7 @@ transmit_blacklist_message (void *cls, | |||
2959 | bm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY); | 2959 | bm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY); |
2960 | bm.is_allowed = htonl (0); | 2960 | bm.is_allowed = htonl (0); |
2961 | bm.peer = bc->peer; | 2961 | bm.peer = bc->peer; |
2962 | memcpy (buf, &bm, sizeof (bm)); | 2962 | memcpy (buf, &bm, sizeof (bm)); |
2963 | GNUNET_SERVER_receive_done (bl->client, GNUNET_OK); | 2963 | GNUNET_SERVER_receive_done (bl->client, GNUNET_OK); |
2964 | return sizeof (bm); | 2964 | return sizeof (bm); |
2965 | } | 2965 | } |
@@ -2969,7 +2969,7 @@ transmit_blacklist_message (void *cls, | |||
2969 | * Perform next action in the blacklist check. | 2969 | * Perform next action in the blacklist check. |
2970 | * | 2970 | * |
2971 | * @param cls the 'struct BlacklistCheck*' | 2971 | * @param cls the 'struct BlacklistCheck*' |
2972 | * @param tc unused | 2972 | * @param tc unused |
2973 | */ | 2973 | */ |
2974 | static void | 2974 | static void |
2975 | do_blacklist_check (void *cls, | 2975 | do_blacklist_check (void *cls, |
@@ -2987,14 +2987,14 @@ do_blacklist_check (void *cls, | |||
2987 | GNUNET_free (bc); | 2987 | GNUNET_free (bc); |
2988 | return; | 2988 | return; |
2989 | } | 2989 | } |
2990 | if (bl->bc == NULL) | 2990 | if (bl->bc == NULL) |
2991 | { | 2991 | { |
2992 | bl->bc = bc; | 2992 | bl->bc = bc; |
2993 | bc->th = GNUNET_SERVER_notify_transmit_ready (bl->client, | 2993 | bc->th = GNUNET_SERVER_notify_transmit_ready (bl->client, |
2994 | sizeof (struct BlacklistMessage), | 2994 | sizeof (struct BlacklistMessage), |
2995 | GNUNET_TIME_UNIT_FOREVER_REL, | 2995 | GNUNET_TIME_UNIT_FOREVER_REL, |
2996 | &transmit_blacklist_message, | 2996 | &transmit_blacklist_message, |
2997 | bc); | 2997 | bc); |
2998 | } | 2998 | } |
2999 | } | 2999 | } |
3000 | 3000 | ||
@@ -3046,7 +3046,7 @@ setup_peer_check_blacklist (const struct GNUNET_PeerIdentity *peer, | |||
3046 | 3046 | ||
3047 | 3047 | ||
3048 | /** | 3048 | /** |
3049 | * Function called with the result of querying a new blacklister about | 3049 | * Function called with the result of querying a new blacklister about |
3050 | * it being allowed (or not) to continue to talk to an existing neighbour. | 3050 | * it being allowed (or not) to continue to talk to an existing neighbour. |
3051 | * | 3051 | * |
3052 | * @param cls the original 'struct NeighbourList' | 3052 | * @param cls the original 'struct NeighbourList' |
@@ -3139,16 +3139,16 @@ handle_blacklist_reply (void *cls, | |||
3139 | bl = bl_head; | 3139 | bl = bl_head; |
3140 | while ( (bl != NULL) && | 3140 | while ( (bl != NULL) && |
3141 | (bl->client != client) ) | 3141 | (bl->client != client) ) |
3142 | bl = bl->next; | 3142 | bl = bl->next; |
3143 | if (bl == NULL) | 3143 | if (bl == NULL) |
3144 | { | 3144 | { |
3145 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 3145 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
3146 | return; | 3146 | return; |
3147 | } | 3147 | } |
3148 | bc = bl->bc; | 3148 | bc = bl->bc; |
3149 | bl->bc = NULL; | 3149 | bl->bc = NULL; |
3150 | if (ntohl (msg->is_allowed) == GNUNET_SYSERR) | 3150 | if (ntohl (msg->is_allowed) == GNUNET_SYSERR) |
3151 | { | 3151 | { |
3152 | bc->cont (bc->cont_cls, NULL); | 3152 | bc->cont (bc->cont_cls, NULL); |
3153 | GNUNET_CONTAINER_DLL_remove (bc_head, bc_tail, bc); | 3153 | GNUNET_CONTAINER_DLL_remove (bc_head, bc_tail, bc); |
3154 | GNUNET_free (bc); | 3154 | GNUNET_free (bc); |
@@ -3158,7 +3158,7 @@ handle_blacklist_reply (void *cls, | |||
3158 | bc->bl_pos = bc->bl_pos->next; | 3158 | bc->bl_pos = bc->bl_pos->next; |
3159 | bc->task = GNUNET_SCHEDULER_add_now (sched, | 3159 | bc->task = GNUNET_SCHEDULER_add_now (sched, |
3160 | &do_blacklist_check, | 3160 | &do_blacklist_check, |
3161 | bc); | 3161 | bc); |
3162 | } | 3162 | } |
3163 | /* check if any other bc's are waiting for this blacklister */ | 3163 | /* check if any other bc's are waiting for this blacklister */ |
3164 | bc = bc_head; | 3164 | bc = bc_head; |
@@ -3168,7 +3168,7 @@ handle_blacklist_reply (void *cls, | |||
3168 | (GNUNET_SCHEDULER_NO_TASK == bc->task) ) | 3168 | (GNUNET_SCHEDULER_NO_TASK == bc->task) ) |
3169 | bc->task = GNUNET_SCHEDULER_add_now (sched, | 3169 | bc->task = GNUNET_SCHEDULER_add_now (sched, |
3170 | &do_blacklist_check, | 3170 | &do_blacklist_check, |
3171 | bc); | 3171 | bc); |
3172 | bc = bc->next; | 3172 | bc = bc->next; |
3173 | } | 3173 | } |
3174 | } | 3174 | } |
@@ -3180,8 +3180,8 @@ handle_blacklist_reply (void *cls, | |||
3180 | * @param cls our 'struct PeriodicValidationContext*' | 3180 | * @param cls our 'struct PeriodicValidationContext*' |
3181 | * @param tc task context | 3181 | * @param tc task context |
3182 | */ | 3182 | */ |
3183 | static void | 3183 | static void |
3184 | send_periodic_ping (void *cls, | 3184 | send_periodic_ping (void *cls, |
3185 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 3185 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
3186 | { | 3186 | { |
3187 | struct ForeignAddressList *peer_address = cls; | 3187 | struct ForeignAddressList *peer_address = cls; |
@@ -3197,13 +3197,13 @@ send_periodic_ping (void *cls, | |||
3197 | 3197 | ||
3198 | peer_address->revalidate_task = GNUNET_SCHEDULER_NO_TASK; | 3198 | peer_address->revalidate_task = GNUNET_SCHEDULER_NO_TASK; |
3199 | if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) | 3199 | if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) |
3200 | return; | 3200 | return; |
3201 | tp = peer_address->ready_list->plugin; | 3201 | tp = peer_address->ready_list->plugin; |
3202 | neighbour = peer_address->ready_list->neighbour; | 3202 | neighbour = peer_address->ready_list->neighbour; |
3203 | if (GNUNET_YES != neighbour->public_key_valid) | 3203 | if (GNUNET_YES != neighbour->public_key_valid) |
3204 | { | 3204 | { |
3205 | /* no public key yet, try again later */ | 3205 | /* no public key yet, try again later */ |
3206 | schedule_next_ping (peer_address); | 3206 | schedule_next_ping (peer_address); |
3207 | return; | 3207 | return; |
3208 | } | 3208 | } |
3209 | caec.addr = peer_address->addr; | 3209 | caec.addr = peer_address->addr; |
@@ -3231,7 +3231,7 @@ send_periodic_ping (void *cls, | |||
3231 | tp->short_name, | 3231 | tp->short_name, |
3232 | GNUNET_i2s (&neighbour->id)); | 3232 | GNUNET_i2s (&neighbour->id)); |
3233 | #endif | 3233 | #endif |
3234 | schedule_next_ping (peer_address); | 3234 | schedule_next_ping (peer_address); |
3235 | return; | 3235 | return; |
3236 | } | 3236 | } |
3237 | va = GNUNET_malloc (sizeof (struct ValidationEntry) + peer_address->addrlen); | 3237 | va = GNUNET_malloc (sizeof (struct ValidationEntry) + peer_address->addrlen); |
@@ -3247,7 +3247,7 @@ send_periodic_ping (void *cls, | |||
3247 | va->addrlen = peer_address->addrlen; | 3247 | va->addrlen = peer_address->addrlen; |
3248 | } | 3248 | } |
3249 | memcpy(&va->publicKey, | 3249 | memcpy(&va->publicKey, |
3250 | &neighbour->publicKey, | 3250 | &neighbour->publicKey, |
3251 | sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); | 3251 | sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); |
3252 | 3252 | ||
3253 | va->timeout_task = GNUNET_SCHEDULER_add_delayed (sched, | 3253 | va->timeout_task = GNUNET_SCHEDULER_add_delayed (sched, |
@@ -3276,14 +3276,14 @@ send_periodic_ping (void *cls, | |||
3276 | memcpy(message_buf, our_hello, hello_size); | 3276 | memcpy(message_buf, our_hello, hello_size); |
3277 | if (peer_address->addr != NULL) | 3277 | if (peer_address->addr != NULL) |
3278 | { | 3278 | { |
3279 | ping.header.size = htons(sizeof(struct TransportPingMessage) + | 3279 | ping.header.size = htons(sizeof(struct TransportPingMessage) + |
3280 | peer_address->addrlen + | 3280 | peer_address->addrlen + |
3281 | slen); | 3281 | slen); |
3282 | memcpy(&message_buf[hello_size + sizeof (struct TransportPingMessage)], | 3282 | memcpy(&message_buf[hello_size + sizeof (struct TransportPingMessage)], |
3283 | tp->short_name, | 3283 | tp->short_name, |
3284 | slen); | 3284 | slen); |
3285 | memcpy(&message_buf[hello_size + sizeof (struct TransportPingMessage) + slen], | 3285 | memcpy(&message_buf[hello_size + sizeof (struct TransportPingMessage) + slen], |
3286 | peer_address->addr, | 3286 | peer_address->addr, |
3287 | peer_address->addrlen); | 3287 | peer_address->addrlen); |
3288 | } | 3288 | } |
3289 | else | 3289 | else |
@@ -3297,7 +3297,7 @@ send_periodic_ping (void *cls, | |||
3297 | #if DEBUG_TRANSPORT_REVALIDATION | 3297 | #if DEBUG_TRANSPORT_REVALIDATION |
3298 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3298 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3299 | "Performing re-validation of address `%s' via `%s' for peer `%4s' sending `%s' (%u bytes) and `%s'\n", | 3299 | "Performing re-validation of address `%s' via `%s' for peer `%4s' sending `%s' (%u bytes) and `%s'\n", |
3300 | (peer_address->addr != NULL) | 3300 | (peer_address->addr != NULL) |
3301 | ? a2s (peer_address->plugin->short_name, | 3301 | ? a2s (peer_address->plugin->short_name, |
3302 | peer_address->addr, | 3302 | peer_address->addr, |
3303 | peer_address->addrlen) | 3303 | peer_address->addrlen) |
@@ -3342,12 +3342,12 @@ schedule_next_ping (struct ForeignAddressList *fal) | |||
3342 | { | 3342 | { |
3343 | delay = GNUNET_TIME_UNIT_ZERO; | 3343 | delay = GNUNET_TIME_UNIT_ZERO; |
3344 | fal->estimated = GNUNET_YES; | 3344 | fal->estimated = GNUNET_YES; |
3345 | } | 3345 | } |
3346 | if (GNUNET_YES == fal->connected) | 3346 | if (GNUNET_YES == fal->connected) |
3347 | { | 3347 | { |
3348 | delay = GNUNET_TIME_relative_min (delay, | 3348 | delay = GNUNET_TIME_relative_min (delay, |
3349 | CONNECTED_LATENCY_EVALUATION_MAX_DELAY); | 3349 | CONNECTED_LATENCY_EVALUATION_MAX_DELAY); |
3350 | } | 3350 | } |
3351 | /* FIXME: also adjust delay based on how close the last | 3351 | /* FIXME: also adjust delay based on how close the last |
3352 | observed latency is to the latency of the best alternative */ | 3352 | observed latency is to the latency of the best alternative */ |
3353 | /* bound how fast we can go */ | 3353 | /* bound how fast we can go */ |
@@ -3355,9 +3355,9 @@ schedule_next_ping (struct ForeignAddressList *fal) | |||
3355 | GNUNET_TIME_UNIT_SECONDS); | 3355 | GNUNET_TIME_UNIT_SECONDS); |
3356 | /* randomize a bit (to avoid doing all at the same time) */ | 3356 | /* randomize a bit (to avoid doing all at the same time) */ |
3357 | delay.value += GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000); | 3357 | delay.value += GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000); |
3358 | fal->revalidate_task = GNUNET_SCHEDULER_add_delayed(sched, | 3358 | fal->revalidate_task = GNUNET_SCHEDULER_add_delayed(sched, |
3359 | delay, | 3359 | delay, |
3360 | &send_periodic_ping, | 3360 | &send_periodic_ping, |
3361 | fal); | 3361 | fal); |
3362 | } | 3362 | } |
3363 | 3363 | ||
@@ -3396,8 +3396,8 @@ handle_payload_message (const struct GNUNET_MessageHeader *message, | |||
3396 | #if DEBUG_TRANSPORT | 3396 | #if DEBUG_TRANSPORT |
3397 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 3397 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
3398 | "Received message of type %u and size %u from `%4s', sending to all clients.\n", | 3398 | "Received message of type %u and size %u from `%4s', sending to all clients.\n", |
3399 | ntohs (message->type), | 3399 | ntohs (message->type), |
3400 | ntohs (message->size), | 3400 | ntohs (message->size), |
3401 | GNUNET_i2s (&n->id)); | 3401 | GNUNET_i2s (&n->id)); |
3402 | #endif | 3402 | #endif |
3403 | if (GNUNET_YES == GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker, | 3403 | if (GNUNET_YES == GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker, |
@@ -3405,8 +3405,8 @@ handle_payload_message (const struct GNUNET_MessageHeader *message, | |||
3405 | { | 3405 | { |
3406 | n->quota_violation_count++; | 3406 | n->quota_violation_count++; |
3407 | #if DEBUG_TRANSPORT | 3407 | #if DEBUG_TRANSPORT |
3408 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3408 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3409 | "Bandwidth quota (%u b/s) violation detected (total of %u).\n", | 3409 | "Bandwidth quota (%u b/s) violation detected (total of %u).\n", |
3410 | n->in_tracker.available_bytes_per_s__, | 3410 | n->in_tracker.available_bytes_per_s__, |
3411 | n->quota_violation_count); | 3411 | n->quota_violation_count); |
3412 | #endif | 3412 | #endif |
@@ -3414,7 +3414,7 @@ handle_payload_message (const struct GNUNET_MessageHeader *message, | |||
3414 | GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker, | 3414 | GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker, |
3415 | - 32 * 1024); | 3415 | - 32 * 1024); |
3416 | } | 3416 | } |
3417 | else | 3417 | else |
3418 | { | 3418 | { |
3419 | if (n->quota_violation_count > 0) | 3419 | if (n->quota_violation_count > 0) |
3420 | { | 3420 | { |
@@ -3488,8 +3488,8 @@ check_pending_validation (void *cls, | |||
3488 | if ( (ps - sizeof (struct TransportPongMessage) != ve->addrlen + slen) || | 3488 | if ( (ps - sizeof (struct TransportPongMessage) != ve->addrlen + slen) || |
3489 | (ve->challenge != challenge) || | 3489 | (ve->challenge != challenge) || |
3490 | (addr[slen-1] != '\0') || | 3490 | (addr[slen-1] != '\0') || |
3491 | (0 != strcmp (addr, ve->transport_name)) || | 3491 | (0 != strcmp (addr, ve->transport_name)) || |
3492 | (ntohl (pong->purpose.size) | 3492 | (ntohl (pong->purpose.size) |
3493 | != sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose) + | 3493 | != sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose) + |
3494 | sizeof (uint32_t) + | 3494 | sizeof (uint32_t) + |
3495 | sizeof (struct GNUNET_TIME_AbsoluteNBO) + | 3495 | sizeof (struct GNUNET_TIME_AbsoluteNBO) + |
@@ -3511,16 +3511,16 @@ check_pending_validation (void *cls, | |||
3511 | } | 3511 | } |
3512 | if (0 != memcmp (&pong->pid, | 3512 | if (0 != memcmp (&pong->pid, |
3513 | key, | 3513 | key, |
3514 | sizeof (struct GNUNET_PeerIdentity))) | 3514 | sizeof (struct GNUNET_PeerIdentity))) |
3515 | { | 3515 | { |
3516 | GNUNET_break_op (0); | 3516 | GNUNET_break_op (0); |
3517 | return GNUNET_NO; | 3517 | return GNUNET_NO; |
3518 | } | 3518 | } |
3519 | if (GNUNET_OK != | 3519 | if (GNUNET_OK != |
3520 | GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN, | 3520 | GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN, |
3521 | &pong->purpose, | 3521 | &pong->purpose, |
3522 | &pong->signature, | 3522 | &pong->signature, |
3523 | &ve->publicKey)) | 3523 | &ve->publicKey)) |
3524 | { | 3524 | { |
3525 | GNUNET_break_op (0); | 3525 | GNUNET_break_op (0); |
3526 | return GNUNET_NO; | 3526 | return GNUNET_NO; |
@@ -3537,7 +3537,7 @@ check_pending_validation (void *cls, | |||
3537 | #endif | 3537 | #endif |
3538 | break; | 3538 | break; |
3539 | case GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_USING: | 3539 | case GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_USING: |
3540 | if (ve->addrlen != 0) | 3540 | if (ve->addrlen != 0) |
3541 | { | 3541 | { |
3542 | return GNUNET_YES; /* different entry, keep trying */ | 3542 | return GNUNET_YES; /* different entry, keep trying */ |
3543 | } | 3543 | } |
@@ -3572,13 +3572,13 @@ check_pending_validation (void *cls, | |||
3572 | a2s (ve->transport_name, | 3572 | a2s (ve->transport_name, |
3573 | &addr[slen], | 3573 | &addr[slen], |
3574 | alen)); | 3574 | alen)); |
3575 | return GNUNET_NO; | 3575 | return GNUNET_NO; |
3576 | } | 3576 | } |
3577 | if (GNUNET_OK != | 3577 | if (GNUNET_OK != |
3578 | GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_USING, | 3578 | GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_USING, |
3579 | &pong->purpose, | 3579 | &pong->purpose, |
3580 | &pong->signature, | 3580 | &pong->signature, |
3581 | &ve->publicKey)) | 3581 | &ve->publicKey)) |
3582 | { | 3582 | { |
3583 | GNUNET_break_op (0); | 3583 | GNUNET_break_op (0); |
3584 | return GNUNET_NO; | 3584 | return GNUNET_NO; |
@@ -3640,7 +3640,7 @@ check_pending_validation (void *cls, | |||
3640 | GNUNET_STATISTICS_update (stats, | 3640 | GNUNET_STATISTICS_update (stats, |
3641 | gettext_noop ("# peer addresses considered valid"), | 3641 | gettext_noop ("# peer addresses considered valid"), |
3642 | 1, | 3642 | 1, |
3643 | GNUNET_NO); | 3643 | GNUNET_NO); |
3644 | fal->latency = GNUNET_TIME_absolute_get_duration (ve->send_time); | 3644 | fal->latency = GNUNET_TIME_absolute_get_duration (ve->send_time); |
3645 | schedule_next_ping (fal); | 3645 | schedule_next_ping (fal); |
3646 | if (n->latency.value == GNUNET_TIME_UNIT_FOREVER_REL.value) | 3646 | if (n->latency.value == GNUNET_TIME_UNIT_FOREVER_REL.value) |
@@ -3778,7 +3778,7 @@ transmit_hello_and_ping (void *cls, | |||
3778 | { | 3778 | { |
3779 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 3779 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
3780 | "Failed to add peer `%4s' for plugin `%s'\n", | 3780 | "Failed to add peer `%4s' for plugin `%s'\n", |
3781 | GNUNET_i2s (&neighbour->id), | 3781 | GNUNET_i2s (&neighbour->id), |
3782 | va->transport_name); | 3782 | va->transport_name); |
3783 | GNUNET_break (GNUNET_OK == | 3783 | GNUNET_break (GNUNET_OK == |
3784 | GNUNET_CONTAINER_multihashmap_remove (validation_map, | 3784 | GNUNET_CONTAINER_multihashmap_remove (validation_map, |
@@ -3808,7 +3808,7 @@ transmit_hello_and_ping (void *cls, | |||
3808 | #if DEBUG_TRANSPORT | 3808 | #if DEBUG_TRANSPORT |
3809 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3809 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3810 | "Performing validation of address `%s' via `%s' for peer `%4s' sending `%s' (%u bytes) and `%s' (%u bytes)\n", | 3810 | "Performing validation of address `%s' via `%s' for peer `%4s' sending `%s' (%u bytes) and `%s' (%u bytes)\n", |
3811 | (va->addrlen == 0) | 3811 | (va->addrlen == 0) |
3812 | ? "<inbound>" | 3812 | ? "<inbound>" |
3813 | : a2s (va->transport_name, | 3813 | : a2s (va->transport_name, |
3814 | (const void*) &va[1], va->addrlen), | 3814 | (const void*) &va[1], va->addrlen), |
@@ -3821,7 +3821,7 @@ transmit_hello_and_ping (void *cls, | |||
3821 | GNUNET_STATISTICS_update (stats, | 3821 | GNUNET_STATISTICS_update (stats, |
3822 | gettext_noop ("# PING messages sent for initial validation"), | 3822 | gettext_noop ("# PING messages sent for initial validation"), |
3823 | 1, | 3823 | 1, |
3824 | GNUNET_NO); | 3824 | GNUNET_NO); |
3825 | transmit_to_peer (NULL, peer_address, | 3825 | transmit_to_peer (NULL, peer_address, |
3826 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 3826 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
3827 | HELLO_VERIFICATION_TIMEOUT, | 3827 | HELLO_VERIFICATION_TIMEOUT, |
@@ -3847,7 +3847,7 @@ static int | |||
3847 | run_validation (void *cls, | 3847 | run_validation (void *cls, |
3848 | const char *tname, | 3848 | const char *tname, |
3849 | struct GNUNET_TIME_Absolute expiration, | 3849 | struct GNUNET_TIME_Absolute expiration, |
3850 | const void *addr, | 3850 | const void *addr, |
3851 | uint16_t addrlen) | 3851 | uint16_t addrlen) |
3852 | { | 3852 | { |
3853 | struct CheckHelloValidatedContext *chvc = cls; | 3853 | struct CheckHelloValidatedContext *chvc = cls; |
@@ -3863,7 +3863,7 @@ run_validation (void *cls, | |||
3863 | GNUNET_STATISTICS_update (stats, | 3863 | GNUNET_STATISTICS_update (stats, |
3864 | gettext_noop ("# peer addresses scheduled for validation"), | 3864 | gettext_noop ("# peer addresses scheduled for validation"), |
3865 | 1, | 3865 | 1, |
3866 | GNUNET_NO); | 3866 | GNUNET_NO); |
3867 | tp = find_transport (tname); | 3867 | tp = find_transport (tname); |
3868 | if (tp == NULL) | 3868 | if (tp == NULL) |
3869 | { | 3869 | { |
@@ -3875,7 +3875,7 @@ run_validation (void *cls, | |||
3875 | GNUNET_STATISTICS_update (stats, | 3875 | GNUNET_STATISTICS_update (stats, |
3876 | gettext_noop ("# peer addresses not validated (plugin not available)"), | 3876 | gettext_noop ("# peer addresses not validated (plugin not available)"), |
3877 | 1, | 3877 | 1, |
3878 | GNUNET_NO); | 3878 | GNUNET_NO); |
3879 | return GNUNET_OK; | 3879 | return GNUNET_OK; |
3880 | } | 3880 | } |
3881 | /* check if this is one of our own addresses */ | 3881 | /* check if this is one of our own addresses */ |
@@ -3891,7 +3891,7 @@ run_validation (void *cls, | |||
3891 | GNUNET_STATISTICS_update (stats, | 3891 | GNUNET_STATISTICS_update (stats, |
3892 | gettext_noop ("# peer addresses not validated (loopback)"), | 3892 | gettext_noop ("# peer addresses not validated (loopback)"), |
3893 | 1, | 3893 | 1, |
3894 | GNUNET_NO); | 3894 | GNUNET_NO); |
3895 | return GNUNET_OK; | 3895 | return GNUNET_OK; |
3896 | } | 3896 | } |
3897 | oal = oal->next; | 3897 | oal = oal->next; |
@@ -3906,8 +3906,8 @@ run_validation (void *cls, | |||
3906 | { | 3906 | { |
3907 | #if DEBUG_TRANSPORT | 3907 | #if DEBUG_TRANSPORT |
3908 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3908 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3909 | "Attempted to validate blacklisted peer `%s' using `%s'!\n", | 3909 | "Attempted to validate blacklisted peer `%s' using `%s'!\n", |
3910 | GNUNET_i2s(&id), | 3910 | GNUNET_i2s(&id), |
3911 | tname); | 3911 | tname); |
3912 | #endif | 3912 | #endif |
3913 | return GNUNET_OK; | 3913 | return GNUNET_OK; |
@@ -3937,7 +3937,7 @@ run_validation (void *cls, | |||
3937 | GNUNET_STATISTICS_update (stats, | 3937 | GNUNET_STATISTICS_update (stats, |
3938 | gettext_noop ("# peer addresses not validated (in progress)"), | 3938 | gettext_noop ("# peer addresses not validated (in progress)"), |
3939 | 1, | 3939 | 1, |
3940 | GNUNET_NO); | 3940 | GNUNET_NO); |
3941 | return GNUNET_OK; | 3941 | return GNUNET_OK; |
3942 | } | 3942 | } |
3943 | va = GNUNET_malloc (sizeof (struct ValidationEntry) + addrlen); | 3943 | va = GNUNET_malloc (sizeof (struct ValidationEntry) + addrlen); |
@@ -4002,7 +4002,7 @@ check_hello_validated (void *cls, | |||
4002 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 4002 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), |
4003 | &target.hashPubKey); | 4003 | &target.hashPubKey); |
4004 | plain_hello = GNUNET_HELLO_create (&pk, | 4004 | plain_hello = GNUNET_HELLO_create (&pk, |
4005 | NULL, | 4005 | NULL, |
4006 | NULL); | 4006 | NULL); |
4007 | GNUNET_PEERINFO_add_peer (peerinfo, plain_hello); | 4007 | GNUNET_PEERINFO_add_peer (peerinfo, plain_hello); |
4008 | GNUNET_free (plain_hello); | 4008 | GNUNET_free (plain_hello); |
@@ -4015,10 +4015,10 @@ check_hello_validated (void *cls, | |||
4015 | GNUNET_STATISTICS_update (stats, | 4015 | GNUNET_STATISTICS_update (stats, |
4016 | gettext_noop ("# new HELLOs requiring full validation"), | 4016 | gettext_noop ("# new HELLOs requiring full validation"), |
4017 | 1, | 4017 | 1, |
4018 | GNUNET_NO); | 4018 | GNUNET_NO); |
4019 | GNUNET_HELLO_iterate_addresses (chvc->hello, | 4019 | GNUNET_HELLO_iterate_addresses (chvc->hello, |
4020 | GNUNET_NO, | 4020 | GNUNET_NO, |
4021 | &run_validation, | 4021 | &run_validation, |
4022 | chvc); | 4022 | chvc); |
4023 | } | 4023 | } |
4024 | else | 4024 | else |
@@ -4026,7 +4026,7 @@ check_hello_validated (void *cls, | |||
4026 | GNUNET_STATISTICS_update (stats, | 4026 | GNUNET_STATISTICS_update (stats, |
4027 | gettext_noop ("# duplicate HELLO (peer known)"), | 4027 | gettext_noop ("# duplicate HELLO (peer known)"), |
4028 | 1, | 4028 | 1, |
4029 | GNUNET_NO); | 4029 | GNUNET_NO); |
4030 | } | 4030 | } |
4031 | chvc->ve_count--; | 4031 | chvc->ve_count--; |
4032 | if (chvc->ve_count == 0) | 4032 | if (chvc->ve_count == 0) |
@@ -4034,10 +4034,10 @@ check_hello_validated (void *cls, | |||
4034 | GNUNET_CONTAINER_DLL_remove (chvc_head, | 4034 | GNUNET_CONTAINER_DLL_remove (chvc_head, |
4035 | chvc_tail, | 4035 | chvc_tail, |
4036 | chvc); | 4036 | chvc); |
4037 | GNUNET_free (chvc); | 4037 | GNUNET_free (chvc); |
4038 | } | 4038 | } |
4039 | return; | 4039 | return; |
4040 | } | 4040 | } |
4041 | if (h == NULL) | 4041 | if (h == NULL) |
4042 | return; | 4042 | return; |
4043 | #if DEBUG_TRANSPORT | 4043 | #if DEBUG_TRANSPORT |
@@ -4061,16 +4061,16 @@ check_hello_validated (void *cls, | |||
4061 | GNUNET_STATISTICS_update (stats, | 4061 | GNUNET_STATISTICS_update (stats, |
4062 | gettext_noop ("# no existing neighbour record (validating HELLO)"), | 4062 | gettext_noop ("# no existing neighbour record (validating HELLO)"), |
4063 | 1, | 4063 | 1, |
4064 | GNUNET_NO); | 4064 | GNUNET_NO); |
4065 | } | 4065 | } |
4066 | GNUNET_STATISTICS_update (stats, | 4066 | GNUNET_STATISTICS_update (stats, |
4067 | gettext_noop ("# HELLO validations (update case)"), | 4067 | gettext_noop ("# HELLO validations (update case)"), |
4068 | 1, | 4068 | 1, |
4069 | GNUNET_NO); | 4069 | GNUNET_NO); |
4070 | GNUNET_HELLO_iterate_new_addresses (chvc->hello, | 4070 | GNUNET_HELLO_iterate_new_addresses (chvc->hello, |
4071 | h, | 4071 | h, |
4072 | GNUNET_TIME_relative_to_absolute (HELLO_REVALIDATION_START_TIME), | 4072 | GNUNET_TIME_relative_to_absolute (HELLO_REVALIDATION_START_TIME), |
4073 | &run_validation, | 4073 | &run_validation, |
4074 | chvc); | 4074 | chvc); |
4075 | } | 4075 | } |
4076 | 4076 | ||
@@ -4104,7 +4104,7 @@ process_hello (struct TransportPlugin *plugin, | |||
4104 | GNUNET_STATISTICS_update (stats, | 4104 | GNUNET_STATISTICS_update (stats, |
4105 | gettext_noop ("# HELLOs received for validation"), | 4105 | gettext_noop ("# HELLOs received for validation"), |
4106 | 1, | 4106 | 1, |
4107 | GNUNET_NO); | 4107 | GNUNET_NO); |
4108 | 4108 | ||
4109 | /* first, check if load is too high */ | 4109 | /* first, check if load is too high */ |
4110 | if (GNUNET_SCHEDULER_get_load (sched, | 4110 | if (GNUNET_SCHEDULER_get_load (sched, |
@@ -4113,7 +4113,7 @@ process_hello (struct TransportPlugin *plugin, | |||
4113 | GNUNET_STATISTICS_update (stats, | 4113 | GNUNET_STATISTICS_update (stats, |
4114 | gettext_noop ("# HELLOs ignored due to high load"), | 4114 | gettext_noop ("# HELLOs ignored due to high load"), |
4115 | 1, | 4115 | 1, |
4116 | GNUNET_NO); | 4116 | GNUNET_NO); |
4117 | #if DEBUG_TRANSPORT_HELLO | 4117 | #if DEBUG_TRANSPORT_HELLO |
4118 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 4118 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
4119 | "Ignoring `%s' for `%4s', load too high.\n", | 4119 | "Ignoring `%s' for `%4s', load too high.\n", |
@@ -4146,8 +4146,8 @@ process_hello (struct TransportPlugin *plugin, | |||
4146 | GNUNET_STATISTICS_update (stats, | 4146 | GNUNET_STATISTICS_update (stats, |
4147 | gettext_noop ("# HELLOs ignored for validation (is my own HELLO)"), | 4147 | gettext_noop ("# HELLOs ignored for validation (is my own HELLO)"), |
4148 | 1, | 4148 | 1, |
4149 | GNUNET_NO); | 4149 | GNUNET_NO); |
4150 | return GNUNET_OK; | 4150 | return GNUNET_OK; |
4151 | } | 4151 | } |
4152 | chvc = chvc_head; | 4152 | chvc = chvc_head; |
4153 | while (NULL != chvc) | 4153 | while (NULL != chvc) |
@@ -4159,7 +4159,7 @@ process_hello (struct TransportPlugin *plugin, | |||
4159 | #if DEBUG_TRANSPORT_HELLO | 4159 | #if DEBUG_TRANSPORT_HELLO |
4160 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 4160 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
4161 | "Received duplicate `%s' message for `%4s'; ignored\n", | 4161 | "Received duplicate `%s' message for `%4s'; ignored\n", |
4162 | "HELLO", | 4162 | "HELLO", |
4163 | GNUNET_i2s (&target)); | 4163 | GNUNET_i2s (&target)); |
4164 | #endif | 4164 | #endif |
4165 | return GNUNET_OK; /* validation already pending */ | 4165 | return GNUNET_OK; /* validation already pending */ |
@@ -4287,12 +4287,12 @@ disconnect_neighbour (struct NeighbourList *n, int check) | |||
4287 | GNUNET_STATISTICS_update (stats, | 4287 | GNUNET_STATISTICS_update (stats, |
4288 | gettext_noop ("# connected addresses"), | 4288 | gettext_noop ("# connected addresses"), |
4289 | -1, | 4289 | -1, |
4290 | GNUNET_NO); | 4290 | GNUNET_NO); |
4291 | if (GNUNET_YES == peer_pos->validated) | 4291 | if (GNUNET_YES == peer_pos->validated) |
4292 | GNUNET_STATISTICS_update (stats, | 4292 | GNUNET_STATISTICS_update (stats, |
4293 | gettext_noop ("# peer addresses considered valid"), | 4293 | gettext_noop ("# peer addresses considered valid"), |
4294 | -1, | 4294 | -1, |
4295 | GNUNET_NO); | 4295 | GNUNET_NO); |
4296 | if (GNUNET_SCHEDULER_NO_TASK != peer_pos->revalidate_task) | 4296 | if (GNUNET_SCHEDULER_NO_TASK != peer_pos->revalidate_task) |
4297 | { | 4297 | { |
4298 | GNUNET_SCHEDULER_cancel (sched, | 4298 | GNUNET_SCHEDULER_cancel (sched, |
@@ -4318,7 +4318,7 @@ disconnect_neighbour (struct NeighbourList *n, int check) | |||
4318 | GNUNET_CONTAINER_DLL_remove (n->messages_head, | 4318 | GNUNET_CONTAINER_DLL_remove (n->messages_head, |
4319 | n->messages_tail, | 4319 | n->messages_tail, |
4320 | mq); | 4320 | mq); |
4321 | GNUNET_assert (0 == memcmp(&mq->neighbour_id, | 4321 | GNUNET_assert (0 == memcmp(&mq->neighbour_id, |
4322 | &n->id, | 4322 | &n->id, |
4323 | sizeof(struct GNUNET_PeerIdentity))); | 4323 | sizeof(struct GNUNET_PeerIdentity))); |
4324 | GNUNET_free (mq); | 4324 | GNUNET_free (mq); |
@@ -4354,9 +4354,9 @@ disconnect_neighbour (struct NeighbourList *n, int check) | |||
4354 | 4354 | ||
4355 | /** | 4355 | /** |
4356 | * We have received a PING message from someone. Need to send a PONG message | 4356 | * We have received a PING message from someone. Need to send a PONG message |
4357 | * in response to the peer by any means necessary. | 4357 | * in response to the peer by any means necessary. |
4358 | */ | 4358 | */ |
4359 | static int | 4359 | static int |
4360 | handle_ping(void *cls, const struct GNUNET_MessageHeader *message, | 4360 | handle_ping(void *cls, const struct GNUNET_MessageHeader *message, |
4361 | const struct GNUNET_PeerIdentity *peer, | 4361 | const struct GNUNET_PeerIdentity *peer, |
4362 | struct Session *session, | 4362 | struct Session *session, |
@@ -4387,17 +4387,17 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, | |||
4387 | sizeof (struct GNUNET_PeerIdentity))) | 4387 | sizeof (struct GNUNET_PeerIdentity))) |
4388 | { | 4388 | { |
4389 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 4389 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
4390 | _("Received `%s' message not destined for me!\n"), | 4390 | _("Received `%s' message not destined for me!\n"), |
4391 | "PING"); | 4391 | "PING"); |
4392 | return GNUNET_SYSERR; | 4392 | return GNUNET_SYSERR; |
4393 | } | 4393 | } |
4394 | #if DEBUG_PING_PONG | 4394 | #if DEBUG_PING_PONG |
4395 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | 4395 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, |
4396 | "Processing `%s' from `%s'\n", | 4396 | "Processing `%s' from `%s'\n", |
4397 | "PING", | 4397 | "PING", |
4398 | (sender_address != NULL) | 4398 | (sender_address != NULL) |
4399 | ? a2s (plugin->short_name, | 4399 | ? a2s (plugin->short_name, |
4400 | (const struct sockaddr *)sender_address, | 4400 | (const struct sockaddr *)sender_address, |
4401 | sender_address_len) | 4401 | sender_address_len) |
4402 | : "<inbound>"); | 4402 | : "<inbound>"); |
4403 | #endif | 4403 | #endif |
@@ -4409,7 +4409,7 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, | |||
4409 | alen = ntohs (message->size) - sizeof (struct TransportPingMessage); | 4409 | alen = ntohs (message->size) - sizeof (struct TransportPingMessage); |
4410 | slen = strlen (plugin->short_name) + 1; | 4410 | slen = strlen (plugin->short_name) + 1; |
4411 | if (alen == 0) | 4411 | if (alen == 0) |
4412 | { | 4412 | { |
4413 | /* peer wants to confirm that we have an outbound connection to him */ | 4413 | /* peer wants to confirm that we have an outbound connection to him */ |
4414 | if (session == NULL) | 4414 | if (session == NULL) |
4415 | { | 4415 | { |
@@ -4429,14 +4429,14 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, | |||
4429 | pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_USING); | 4429 | pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_USING); |
4430 | pong->challenge = ping->challenge; | 4430 | pong->challenge = ping->challenge; |
4431 | pong->addrlen = htonl(sender_address_len + slen); | 4431 | pong->addrlen = htonl(sender_address_len + slen); |
4432 | memcpy(&pong->pid, | 4432 | memcpy(&pong->pid, |
4433 | peer, | 4433 | peer, |
4434 | sizeof(struct GNUNET_PeerIdentity)); | 4434 | sizeof(struct GNUNET_PeerIdentity)); |
4435 | memcpy (&pong[1], | 4435 | memcpy (&pong[1], |
4436 | plugin->short_name, | 4436 | plugin->short_name, |
4437 | slen); | 4437 | slen); |
4438 | memcpy (&((char*)&pong[1])[slen], | 4438 | memcpy (&((char*)&pong[1])[slen], |
4439 | sender_address, | 4439 | sender_address, |
4440 | sender_address_len); | 4440 | sender_address_len); |
4441 | if (GNUNET_TIME_absolute_get_remaining (session_header->pong_sig_expires).value < PONG_SIGNATURE_LIFETIME.value / 4) | 4441 | if (GNUNET_TIME_absolute_get_remaining (session_header->pong_sig_expires).value < PONG_SIGNATURE_LIFETIME.value / 4) |
4442 | { | 4442 | { |
@@ -4458,7 +4458,7 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, | |||
4458 | } | 4458 | } |
4459 | memcpy (&pong->signature, | 4459 | memcpy (&pong->signature, |
4460 | &session_header->pong_signature, | 4460 | &session_header->pong_signature, |
4461 | sizeof (struct GNUNET_CRYPTO_RsaSignature)); | 4461 | sizeof (struct GNUNET_CRYPTO_RsaSignature)); |
4462 | 4462 | ||
4463 | 4463 | ||
4464 | } | 4464 | } |
@@ -4500,8 +4500,8 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, | |||
4500 | pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN); | 4500 | pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN); |
4501 | pong->challenge = ping->challenge; | 4501 | pong->challenge = ping->challenge; |
4502 | pong->addrlen = htonl(alen + slen); | 4502 | pong->addrlen = htonl(alen + slen); |
4503 | memcpy(&pong->pid, | 4503 | memcpy(&pong->pid, |
4504 | &my_identity, | 4504 | &my_identity, |
4505 | sizeof(struct GNUNET_PeerIdentity)); | 4505 | sizeof(struct GNUNET_PeerIdentity)); |
4506 | memcpy (&pong[1], plugin->short_name, slen); | 4506 | memcpy (&pong[1], plugin->short_name, slen); |
4507 | memcpy (&((char*)&pong[1])[slen], addr, alen); | 4507 | memcpy (&((char*)&pong[1])[slen], addr, alen); |
@@ -4519,10 +4519,10 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, | |||
4519 | GNUNET_assert (GNUNET_OK == | 4519 | GNUNET_assert (GNUNET_OK == |
4520 | GNUNET_CRYPTO_rsa_sign (my_private_key, | 4520 | GNUNET_CRYPTO_rsa_sign (my_private_key, |
4521 | &pong->purpose, | 4521 | &pong->purpose, |
4522 | &oal->pong_signature)); | 4522 | &oal->pong_signature)); |
4523 | memcpy (&pong->signature, | 4523 | memcpy (&pong->signature, |
4524 | &oal->pong_signature, | 4524 | &oal->pong_signature, |
4525 | sizeof (struct GNUNET_CRYPTO_RsaSignature)); | 4525 | sizeof (struct GNUNET_CRYPTO_RsaSignature)); |
4526 | } | 4526 | } |
4527 | else if (oal == NULL) | 4527 | else if (oal == NULL) |
4528 | { | 4528 | { |
@@ -4531,7 +4531,7 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, | |||
4531 | GNUNET_assert (GNUNET_OK == | 4531 | GNUNET_assert (GNUNET_OK == |
4532 | GNUNET_CRYPTO_rsa_sign (my_private_key, | 4532 | GNUNET_CRYPTO_rsa_sign (my_private_key, |
4533 | &pong->purpose, | 4533 | &pong->purpose, |
4534 | &pong->signature)); | 4534 | &pong->signature)); |
4535 | } | 4535 | } |
4536 | else | 4536 | else |
4537 | { | 4537 | { |
@@ -4539,7 +4539,7 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, | |||
4539 | pong->expiration = GNUNET_TIME_absolute_hton (oal->pong_sig_expires); | 4539 | pong->expiration = GNUNET_TIME_absolute_hton (oal->pong_sig_expires); |
4540 | memcpy (&pong->signature, | 4540 | memcpy (&pong->signature, |
4541 | &oal->pong_signature, | 4541 | &oal->pong_signature, |
4542 | sizeof (struct GNUNET_CRYPTO_RsaSignature)); | 4542 | sizeof (struct GNUNET_CRYPTO_RsaSignature)); |
4543 | } | 4543 | } |
4544 | } | 4544 | } |
4545 | n = find_neighbour(peer); | 4545 | n = find_neighbour(peer); |
@@ -4555,7 +4555,7 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, | |||
4555 | peer, | 4555 | peer, |
4556 | (const char*) pong, | 4556 | (const char*) pong, |
4557 | ntohs (pong->header.size), | 4557 | ntohs (pong->header.size), |
4558 | TRANSPORT_PONG_PRIORITY, | 4558 | TRANSPORT_PONG_PRIORITY, |
4559 | HELLO_VERIFICATION_TIMEOUT, | 4559 | HELLO_VERIFICATION_TIMEOUT, |
4560 | fal->session, | 4560 | fal->session, |
4561 | fal->addr, | 4561 | fal->addr, |
@@ -4567,7 +4567,7 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, | |||
4567 | GNUNET_STATISTICS_update (stats, | 4567 | GNUNET_STATISTICS_update (stats, |
4568 | gettext_noop ("# PONGs unicast via reliable transport"), | 4568 | gettext_noop ("# PONGs unicast via reliable transport"), |
4569 | 1, | 4569 | 1, |
4570 | GNUNET_NO); | 4570 | GNUNET_NO); |
4571 | GNUNET_free (pong); | 4571 | GNUNET_free (pong); |
4572 | return GNUNET_OK; | 4572 | return GNUNET_OK; |
4573 | } | 4573 | } |
@@ -4579,7 +4579,7 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, | |||
4579 | GNUNET_STATISTICS_update (stats, | 4579 | GNUNET_STATISTICS_update (stats, |
4580 | gettext_noop ("# PONGs multicast to all available addresses"), | 4580 | gettext_noop ("# PONGs multicast to all available addresses"), |
4581 | 1, | 4581 | 1, |
4582 | GNUNET_NO); | 4582 | GNUNET_NO); |
4583 | rl = n->plugins; | 4583 | rl = n->plugins; |
4584 | while (rl != NULL) | 4584 | while (rl != NULL) |
4585 | { | 4585 | { |
@@ -4587,11 +4587,11 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message, | |||
4587 | while (fal != NULL) | 4587 | while (fal != NULL) |
4588 | { | 4588 | { |
4589 | transmit_to_peer(NULL, fal, | 4589 | transmit_to_peer(NULL, fal, |
4590 | TRANSPORT_PONG_PRIORITY, | 4590 | TRANSPORT_PONG_PRIORITY, |
4591 | HELLO_VERIFICATION_TIMEOUT, | 4591 | HELLO_VERIFICATION_TIMEOUT, |
4592 | (const char *)pong, | 4592 | (const char *)pong, |
4593 | ntohs(pong->header.size), | 4593 | ntohs(pong->header.size), |
4594 | GNUNET_YES, | 4594 | GNUNET_YES, |
4595 | n); | 4595 | n); |
4596 | fal = fal->next; | 4596 | fal = fal->next; |
4597 | } | 4597 | } |
@@ -4648,11 +4648,11 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
4648 | { | 4648 | { |
4649 | if ( (session != NULL) || | 4649 | if ( (session != NULL) || |
4650 | (sender_address != NULL) ) | 4650 | (sender_address != NULL) ) |
4651 | peer_address = add_peer_address (n, | 4651 | peer_address = add_peer_address (n, |
4652 | plugin->short_name, | 4652 | plugin->short_name, |
4653 | session, | 4653 | session, |
4654 | sender_address, | 4654 | sender_address, |
4655 | sender_address_len); | 4655 | sender_address_len); |
4656 | if (peer_address != NULL) | 4656 | if (peer_address != NULL) |
4657 | { | 4657 | { |
4658 | peer_address->distance = distance; | 4658 | peer_address->distance = distance; |
@@ -4665,7 +4665,7 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
4665 | schedule_next_ping (peer_address); | 4665 | schedule_next_ping (peer_address); |
4666 | } | 4666 | } |
4667 | /* update traffic received amount ... */ | 4667 | /* update traffic received amount ... */ |
4668 | msize = ntohs (message->size); | 4668 | msize = ntohs (message->size); |
4669 | GNUNET_STATISTICS_update (stats, | 4669 | GNUNET_STATISTICS_update (stats, |
4670 | gettext_noop ("# bytes received from other peers"), | 4670 | gettext_noop ("# bytes received from other peers"), |
4671 | msize, | 4671 | msize, |
@@ -4686,7 +4686,7 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
4686 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING | | 4686 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING | |
4687 | GNUNET_ERROR_TYPE_BULK, | 4687 | GNUNET_ERROR_TYPE_BULK, |
4688 | _ | 4688 | _ |
4689 | ("Dropping incoming message due to repeated bandwidth quota (%u b/s) violations (total of %u).\n"), | 4689 | ("Dropping incoming message due to repeated bandwidth quota (%u b/s) violations (total of %u).\n"), |
4690 | n->in_tracker.available_bytes_per_s__, | 4690 | n->in_tracker.available_bytes_per_s__, |
4691 | n->quota_violation_count); | 4691 | n->quota_violation_count); |
4692 | GNUNET_STATISTICS_update (stats, | 4692 | GNUNET_STATISTICS_update (stats, |
@@ -4699,8 +4699,8 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
4699 | #if DEBUG_PING_PONG | 4699 | #if DEBUG_PING_PONG |
4700 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 4700 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
4701 | "Received message of type %u and size %u from `%4s', sending to all clients.\n", | 4701 | "Received message of type %u and size %u from `%4s', sending to all clients.\n", |
4702 | ntohs (message->type), | 4702 | ntohs (message->type), |
4703 | ntohs (message->size), | 4703 | ntohs (message->size), |
4704 | GNUNET_i2s (peer)); | 4704 | GNUNET_i2s (peer)); |
4705 | #endif | 4705 | #endif |
4706 | switch (ntohs (message->type)) | 4706 | switch (ntohs (message->type)) |
@@ -4722,7 +4722,7 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
4722 | handle_payload_message (message, n); | 4722 | handle_payload_message (message, n); |
4723 | break; | 4723 | break; |
4724 | } | 4724 | } |
4725 | } | 4725 | } |
4726 | ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 0); | 4726 | ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 0); |
4727 | if (ret.value > 0) | 4727 | if (ret.value > 0) |
4728 | { | 4728 | { |
@@ -4734,7 +4734,7 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
4734 | GNUNET_STATISTICS_update (stats, | 4734 | GNUNET_STATISTICS_update (stats, |
4735 | gettext_noop ("# ms throttling suggested"), | 4735 | gettext_noop ("# ms throttling suggested"), |
4736 | (int64_t) ret.value, | 4736 | (int64_t) ret.value, |
4737 | GNUNET_NO); | 4737 | GNUNET_NO); |
4738 | } | 4738 | } |
4739 | return ret; | 4739 | return ret; |
4740 | } | 4740 | } |
@@ -4783,7 +4783,7 @@ handle_start (void *cls, | |||
4783 | _("Rejecting control connection from peer `%s', which is not me!\n"), | 4783 | _("Rejecting control connection from peer `%s', which is not me!\n"), |
4784 | GNUNET_i2s (&start->self)); | 4784 | GNUNET_i2s (&start->self)); |
4785 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 4785 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
4786 | return; | 4786 | return; |
4787 | } | 4787 | } |
4788 | c = GNUNET_malloc (sizeof (struct TransportClient)); | 4788 | c = GNUNET_malloc (sizeof (struct TransportClient)); |
4789 | c->next = clients; | 4789 | c->next = clients; |
@@ -4801,7 +4801,7 @@ handle_start (void *cls, | |||
4801 | /* tell new client about all existing connections */ | 4801 | /* tell new client about all existing connections */ |
4802 | cim.header.size = htons (sizeof (struct ConnectInfoMessage)); | 4802 | cim.header.size = htons (sizeof (struct ConnectInfoMessage)); |
4803 | cim.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); | 4803 | cim.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); |
4804 | n = neighbours; | 4804 | n = neighbours; |
4805 | while (n != NULL) | 4805 | while (n != NULL) |
4806 | { | 4806 | { |
4807 | if (GNUNET_YES == n->received_pong) | 4807 | if (GNUNET_YES == n->received_pong) |
@@ -4835,7 +4835,7 @@ handle_hello (void *cls, | |||
4835 | GNUNET_STATISTICS_update (stats, | 4835 | GNUNET_STATISTICS_update (stats, |
4836 | gettext_noop ("# HELLOs received from clients"), | 4836 | gettext_noop ("# HELLOs received from clients"), |
4837 | 1, | 4837 | 1, |
4838 | GNUNET_NO); | 4838 | GNUNET_NO); |
4839 | ret = process_hello (NULL, message); | 4839 | ret = process_hello (NULL, message); |
4840 | GNUNET_SERVER_receive_done (client, ret); | 4840 | GNUNET_SERVER_receive_done (client, ret); |
4841 | } | 4841 | } |
@@ -4845,7 +4845,7 @@ handle_hello (void *cls, | |||
4845 | * Closure for 'transmit_client_message'; followed by | 4845 | * Closure for 'transmit_client_message'; followed by |
4846 | * 'msize' bytes of the actual message. | 4846 | * 'msize' bytes of the actual message. |
4847 | */ | 4847 | */ |
4848 | struct TransmitClientMessageContext | 4848 | struct TransmitClientMessageContext |
4849 | { | 4849 | { |
4850 | /** | 4850 | /** |
4851 | * Client on whom's behalf we are sending. | 4851 | * Client on whom's behalf we are sending. |
@@ -4856,7 +4856,7 @@ struct TransmitClientMessageContext | |||
4856 | * Timeout for the transmission. | 4856 | * Timeout for the transmission. |
4857 | */ | 4857 | */ |
4858 | struct GNUNET_TIME_Absolute timeout; | 4858 | struct GNUNET_TIME_Absolute timeout; |
4859 | 4859 | ||
4860 | /** | 4860 | /** |
4861 | * Message priority. | 4861 | * Message priority. |
4862 | */ | 4862 | */ |
@@ -4864,7 +4864,7 @@ struct TransmitClientMessageContext | |||
4864 | 4864 | ||
4865 | /** | 4865 | /** |
4866 | * Size of the message in bytes. | 4866 | * Size of the message in bytes. |
4867 | */ | 4867 | */ |
4868 | uint16_t msize; | 4868 | uint16_t msize; |
4869 | }; | 4869 | }; |
4870 | 4870 | ||
@@ -4888,7 +4888,7 @@ transmit_client_message (void *cls, | |||
4888 | 4888 | ||
4889 | if (n != NULL) | 4889 | if (n != NULL) |
4890 | { | 4890 | { |
4891 | transmit_to_peer (tc, NULL, tcmc->priority, | 4891 | transmit_to_peer (tc, NULL, tcmc->priority, |
4892 | GNUNET_TIME_absolute_get_remaining (tcmc->timeout), | 4892 | GNUNET_TIME_absolute_get_remaining (tcmc->timeout), |
4893 | (char *)&tcmc[1], | 4893 | (char *)&tcmc[1], |
4894 | tcmc->msize, GNUNET_NO, n); | 4894 | tcmc->msize, GNUNET_NO, n); |
@@ -4928,7 +4928,7 @@ handle_send (void *cls, | |||
4928 | GNUNET_STATISTICS_update (stats, | 4928 | GNUNET_STATISTICS_update (stats, |
4929 | gettext_noop ("# payload received for other peers"), | 4929 | gettext_noop ("# payload received for other peers"), |
4930 | size, | 4930 | size, |
4931 | GNUNET_NO); | 4931 | GNUNET_NO); |
4932 | obm = (const struct OutboundMessage *) message; | 4932 | obm = (const struct OutboundMessage *) message; |
4933 | obmm = (const struct GNUNET_MessageHeader *) &obm[1]; | 4933 | obmm = (const struct GNUNET_MessageHeader *) &obm[1]; |
4934 | msize = size - sizeof (struct OutboundMessage); | 4934 | msize = size - sizeof (struct OutboundMessage); |
@@ -4968,11 +4968,11 @@ handle_set_quota (void *cls, | |||
4968 | const struct QuotaSetMessage *qsm = | 4968 | const struct QuotaSetMessage *qsm = |
4969 | (const struct QuotaSetMessage *) message; | 4969 | (const struct QuotaSetMessage *) message; |
4970 | struct NeighbourList *n; | 4970 | struct NeighbourList *n; |
4971 | 4971 | ||
4972 | GNUNET_STATISTICS_update (stats, | 4972 | GNUNET_STATISTICS_update (stats, |
4973 | gettext_noop ("# SET QUOTA messages received"), | 4973 | gettext_noop ("# SET QUOTA messages received"), |
4974 | 1, | 4974 | 1, |
4975 | GNUNET_NO); | 4975 | GNUNET_NO); |
4976 | n = find_neighbour (&qsm->peer); | 4976 | n = find_neighbour (&qsm->peer); |
4977 | if (n == NULL) | 4977 | if (n == NULL) |
4978 | { | 4978 | { |
@@ -4980,20 +4980,20 @@ handle_set_quota (void *cls, | |||
4980 | GNUNET_STATISTICS_update (stats, | 4980 | GNUNET_STATISTICS_update (stats, |
4981 | gettext_noop ("# SET QUOTA messages ignored (no such peer)"), | 4981 | gettext_noop ("# SET QUOTA messages ignored (no such peer)"), |
4982 | 1, | 4982 | 1, |
4983 | GNUNET_NO); | 4983 | GNUNET_NO); |
4984 | return; | 4984 | return; |
4985 | } | 4985 | } |
4986 | #if DEBUG_TRANSPORT | 4986 | #if DEBUG_TRANSPORT |
4987 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 4987 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
4988 | "Received `%s' request (new quota %u, old quota %u) from client for peer `%4s'\n", | 4988 | "Received `%s' request (new quota %u, old quota %u) from client for peer `%4s'\n", |
4989 | "SET_QUOTA", | 4989 | "SET_QUOTA", |
4990 | (unsigned int) ntohl (qsm->quota.value__), | 4990 | (unsigned int) ntohl (qsm->quota.value__), |
4991 | (unsigned int) n->in_tracker.available_bytes_per_s__, | 4991 | (unsigned int) n->in_tracker.available_bytes_per_s__, |
4992 | GNUNET_i2s (&qsm->peer)); | 4992 | GNUNET_i2s (&qsm->peer)); |
4993 | #endif | 4993 | #endif |
4994 | GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker, | 4994 | GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker, |
4995 | qsm->quota); | 4995 | qsm->quota); |
4996 | if (0 == ntohl (qsm->quota.value__)) | 4996 | if (0 == ntohl (qsm->quota.value__)) |
4997 | { | 4997 | { |
4998 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 4998 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
4999 | "Disconnecting peer `%4s', %s\n", GNUNET_i2s(&n->id), | 4999 | "Disconnecting peer `%4s', %s\n", GNUNET_i2s(&n->id), |
@@ -5007,7 +5007,7 @@ handle_set_quota (void *cls, | |||
5007 | /** | 5007 | /** |
5008 | * Take the given address and append it to the set of results sent back to | 5008 | * Take the given address and append it to the set of results sent back to |
5009 | * the client. | 5009 | * the client. |
5010 | * | 5010 | * |
5011 | * @param cls the transmission context used ('struct GNUNET_SERVER_TransmitContext*') | 5011 | * @param cls the transmission context used ('struct GNUNET_SERVER_TransmitContext*') |
5012 | * @param address the resolved name, NULL to indicate the last response | 5012 | * @param address the resolved name, NULL to indicate the last response |
5013 | */ | 5013 | */ |
@@ -5090,7 +5090,7 @@ handle_address_lookup (void *cls, | |||
5090 | tc = GNUNET_SERVER_transmit_context_create (client); | 5090 | tc = GNUNET_SERVER_transmit_context_create (client); |
5091 | lsPlugin->api->address_pretty_printer (lsPlugin->api->cls, | 5091 | lsPlugin->api->address_pretty_printer (lsPlugin->api->cls, |
5092 | nameTransport, | 5092 | nameTransport, |
5093 | address, addressLen, | 5093 | address, addressLen, |
5094 | numeric, | 5094 | numeric, |
5095 | rtimeout, | 5095 | rtimeout, |
5096 | &transmit_address_to_client, tc); | 5096 | &transmit_address_to_client, tc); |
@@ -5120,7 +5120,7 @@ create_environment (struct TransportPlugin *plug) | |||
5120 | * Start the specified transport (load the plugin). | 5120 | * Start the specified transport (load the plugin). |
5121 | */ | 5121 | */ |
5122 | static void | 5122 | static void |
5123 | start_transport (struct GNUNET_SERVER_Handle *server, | 5123 | start_transport (struct GNUNET_SERVER_Handle *server, |
5124 | const char *name) | 5124 | const char *name) |
5125 | { | 5125 | { |
5126 | struct TransportPlugin *plug; | 5126 | struct TransportPlugin *plug; |
@@ -5186,7 +5186,7 @@ client_disconnect_notification (void *cls, | |||
5186 | if (bc->th != NULL) | 5186 | if (bc->th != NULL) |
5187 | { | 5187 | { |
5188 | GNUNET_CONNECTION_notify_transmit_ready_cancel (bc->th); | 5188 | GNUNET_CONNECTION_notify_transmit_ready_cancel (bc->th); |
5189 | bc->th = NULL; | 5189 | bc->th = NULL; |
5190 | } | 5190 | } |
5191 | if (bc->task == GNUNET_SCHEDULER_NO_TASK) | 5191 | if (bc->task == GNUNET_SCHEDULER_NO_TASK) |
5192 | bc->task = GNUNET_SCHEDULER_add_now (sched, | 5192 | bc->task = GNUNET_SCHEDULER_add_now (sched, |
@@ -5272,7 +5272,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
5272 | plugins = plug->next; | 5272 | plugins = plug->next; |
5273 | if (plug->address_update_task != GNUNET_SCHEDULER_NO_TASK) | 5273 | if (plug->address_update_task != GNUNET_SCHEDULER_NO_TASK) |
5274 | { | 5274 | { |
5275 | GNUNET_SCHEDULER_cancel (plug->env.sched, | 5275 | GNUNET_SCHEDULER_cancel (plug->env.sched, |
5276 | plug->address_update_task); | 5276 | plug->address_update_task); |
5277 | plug->address_update_task = GNUNET_SCHEDULER_NO_TASK; | 5277 | plug->address_update_task = GNUNET_SCHEDULER_NO_TASK; |
5278 | } | 5278 | } |
@@ -5403,7 +5403,7 @@ run (void *cls, | |||
5403 | if (peerinfo == NULL) | 5403 | if (peerinfo == NULL) |
5404 | { | 5404 | { |
5405 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 5405 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
5406 | _("Could not access PEERINFO service. Exiting.\n")); | 5406 | _("Could not access PEERINFO service. Exiting.\n")); |
5407 | GNUNET_SCHEDULER_shutdown (s); | 5407 | GNUNET_SCHEDULER_shutdown (s); |
5408 | if (stats != NULL) | 5408 | if (stats != NULL) |
5409 | { | 5409 | { |