diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/gnunet-service-core.c | 11 | ||||
-rw-r--r-- | src/core/gnunet-service-core_kx.c | 23 | ||||
-rw-r--r-- | src/core/gnunet-service-core_sessions.c | 96 | ||||
-rw-r--r-- | src/core/gnunet-service-core_typemap.c | 21 | ||||
-rw-r--r-- | src/transport/plugin_transport_udp.c | 15 | ||||
-rw-r--r-- | src/transport/transport_api_core.c | 3 |
6 files changed, 122 insertions, 47 deletions
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index b0d7b24ba..52c6f72ab 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c | |||
@@ -696,6 +696,11 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client, | |||
696 | new_match = GSC_TYPEMAP_test_match (tmap_new, | 696 | new_match = GSC_TYPEMAP_test_match (tmap_new, |
697 | client->types, | 697 | client->types, |
698 | client->tcnt); | 698 | client->tcnt); |
699 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
700 | "Notifying client about neighbour %s (%d/%d)\n", | ||
701 | GNUNET_i2s (neighbour), | ||
702 | old_match, | ||
703 | new_match); | ||
699 | if (old_match == new_match) | 704 | if (old_match == new_match) |
700 | { | 705 | { |
701 | GNUNET_assert (old_match == | 706 | GNUNET_assert (old_match == |
@@ -720,7 +725,8 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client, | |||
720 | GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT); | 725 | GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT); |
721 | cnm->reserved = htonl (0); | 726 | cnm->reserved = htonl (0); |
722 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 727 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
723 | "Sending NOTIFY_CONNECT message to client.\n"); | 728 | "Sending NOTIFY_CONNECT message about peer %s to client.\n", |
729 | GNUNET_i2s (neighbour)); | ||
724 | cnm->peer = *neighbour; | 730 | cnm->peer = *neighbour; |
725 | GNUNET_MQ_send (client->mq, | 731 | GNUNET_MQ_send (client->mq, |
726 | env); | 732 | env); |
@@ -740,6 +746,9 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client, | |||
740 | env = GNUNET_MQ_msg (dcm, | 746 | env = GNUNET_MQ_msg (dcm, |
741 | GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT); | 747 | GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT); |
742 | dcm->reserved = htonl (0); | 748 | dcm->reserved = htonl (0); |
749 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
750 | "Sending NOTIFY_DISCONNECT message about peer %s to client.\n", | ||
751 | GNUNET_i2s (neighbour)); | ||
743 | dcm->peer = *neighbour; | 752 | dcm->peer = *neighbour; |
744 | GNUNET_MQ_send (client->mq, | 753 | GNUNET_MQ_send (client->mq, |
745 | env); | 754 | env); |
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index 6743ce215..a0c343737 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c | |||
@@ -261,7 +261,7 @@ struct GSC_KeyExchangeInfo | |||
261 | * Message queue for sending messages to @a peer. | 261 | * Message queue for sending messages to @a peer. |
262 | */ | 262 | */ |
263 | struct GNUNET_MQ_Handle *mq; | 263 | struct GNUNET_MQ_Handle *mq; |
264 | 264 | ||
265 | /** | 265 | /** |
266 | * PING message we transmit to the other peer. | 266 | * PING message we transmit to the other peer. |
267 | */ | 267 | */ |
@@ -777,7 +777,7 @@ handle_transport_notify_disconnect (void *cls, | |||
777 | void *handler_cls) | 777 | void *handler_cls) |
778 | { | 778 | { |
779 | struct GSC_KeyExchangeInfo *kx = handler_cls; | 779 | struct GSC_KeyExchangeInfo *kx = handler_cls; |
780 | 780 | ||
781 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 781 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
782 | "Peer `%s' disconnected from us.\n", | 782 | "Peer `%s' disconnected from us.\n", |
783 | GNUNET_i2s (peer)); | 783 | GNUNET_i2s (peer)); |
@@ -814,7 +814,7 @@ static void | |||
814 | send_ping (struct GSC_KeyExchangeInfo *kx) | 814 | send_ping (struct GSC_KeyExchangeInfo *kx) |
815 | { | 815 | { |
816 | struct GNUNET_MQ_Envelope *env; | 816 | struct GNUNET_MQ_Envelope *env; |
817 | 817 | ||
818 | GNUNET_STATISTICS_update (GSC_stats, | 818 | GNUNET_STATISTICS_update (GSC_stats, |
819 | gettext_noop ("# PING messages transmitted"), | 819 | gettext_noop ("# PING messages transmitted"), |
820 | 1, | 820 | 1, |
@@ -1332,7 +1332,7 @@ static void | |||
1332 | send_key (struct GSC_KeyExchangeInfo *kx) | 1332 | send_key (struct GSC_KeyExchangeInfo *kx) |
1333 | { | 1333 | { |
1334 | struct GNUNET_MQ_Envelope *env; | 1334 | struct GNUNET_MQ_Envelope *env; |
1335 | 1335 | ||
1336 | GNUNET_assert (GNUNET_CORE_KX_STATE_DOWN != kx->status); | 1336 | GNUNET_assert (GNUNET_CORE_KX_STATE_DOWN != kx->status); |
1337 | if (NULL != kx->retry_set_key_task) | 1337 | if (NULL != kx->retry_set_key_task) |
1338 | { | 1338 | { |
@@ -1520,7 +1520,7 @@ handle_encrypted (void *cls, | |||
1520 | sizeof (struct GNUNET_HashCode))) | 1520 | sizeof (struct GNUNET_HashCode))) |
1521 | { | 1521 | { |
1522 | /* checksum failed */ | 1522 | /* checksum failed */ |
1523 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1523 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1524 | "Failed checksum validation for a message from `%s'\n", | 1524 | "Failed checksum validation for a message from `%s'\n", |
1525 | GNUNET_i2s (kx->peer)); | 1525 | GNUNET_i2s (kx->peer)); |
1526 | return; | 1526 | return; |
@@ -1536,7 +1536,10 @@ handle_encrypted (void *cls, | |||
1536 | &m->sequence_number, | 1536 | &m->sequence_number, |
1537 | &buf[ENCRYPTED_HEADER_SIZE], | 1537 | &buf[ENCRYPTED_HEADER_SIZE], |
1538 | size - ENCRYPTED_HEADER_SIZE)) | 1538 | size - ENCRYPTED_HEADER_SIZE)) |
1539 | { | ||
1540 | GNUNET_break_op (0); | ||
1539 | return; | 1541 | return; |
1542 | } | ||
1540 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1543 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1541 | "Decrypted %u bytes from %s\n", | 1544 | "Decrypted %u bytes from %s\n", |
1542 | (unsigned int) (size - ENCRYPTED_HEADER_SIZE), | 1545 | (unsigned int) (size - ENCRYPTED_HEADER_SIZE), |
@@ -1642,7 +1645,7 @@ handle_transport_notify_excess_bw (void *cls, | |||
1642 | const struct GNUNET_PeerIdentity *pid, | 1645 | const struct GNUNET_PeerIdentity *pid, |
1643 | void *connect_cls) | 1646 | void *connect_cls) |
1644 | { | 1647 | { |
1645 | struct GSC_KeyExchangeInfo *kx = connect_cls; | 1648 | struct GSC_KeyExchangeInfo *kx = connect_cls; |
1646 | 1649 | ||
1647 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1650 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1648 | "Peer %s has excess bandwidth available\n", | 1651 | "Peer %s has excess bandwidth available\n", |
@@ -1668,6 +1671,10 @@ deliver_message (void *cls, | |||
1668 | { | 1671 | { |
1669 | struct DeliverMessageContext *dmc = client; | 1672 | struct DeliverMessageContext *dmc = client; |
1670 | 1673 | ||
1674 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1675 | "Decrypted message of type %d from %s\n", | ||
1676 | ntohs (m->type), | ||
1677 | GNUNET_i2s (dmc->peer)); | ||
1671 | if (GNUNET_CORE_KX_STATE_UP != dmc->kx->status) | 1678 | if (GNUNET_CORE_KX_STATE_UP != dmc->kx->status) |
1672 | { | 1679 | { |
1673 | GNUNET_STATISTICS_update (GSC_stats, | 1680 | GNUNET_STATISTICS_update (GSC_stats, |
@@ -1824,7 +1831,7 @@ GSC_KX_init (struct GNUNET_CRYPTO_EddsaPrivateKey *pk) | |||
1824 | NULL); | 1831 | NULL); |
1825 | mst = GNUNET_SERVER_mst_create (&deliver_message, | 1832 | mst = GNUNET_SERVER_mst_create (&deliver_message, |
1826 | NULL); | 1833 | NULL); |
1827 | transport | 1834 | transport |
1828 | = GNUNET_TRANSPORT_core_connect (GSC_cfg, | 1835 | = GNUNET_TRANSPORT_core_connect (GSC_cfg, |
1829 | &GSC_my_identity, | 1836 | &GSC_my_identity, |
1830 | handlers, | 1837 | handlers, |
@@ -1927,7 +1934,7 @@ GSC_KX_handle_client_monitor_peers (struct GNUNET_MQ_Handle *mq) | |||
1927 | { | 1934 | { |
1928 | struct GNUNET_MQ_Envelope *env; | 1935 | struct GNUNET_MQ_Envelope *env; |
1929 | struct MonitorNotifyMessage *msg; | 1936 | struct MonitorNotifyMessage *msg; |
1930 | 1937 | ||
1931 | env = GNUNET_MQ_msg (msg, | 1938 | env = GNUNET_MQ_msg (msg, |
1932 | GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY); | 1939 | GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY); |
1933 | msg->state = htonl ((uint32_t) kx->status); | 1940 | msg->state = htonl ((uint32_t) kx->status); |
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c index 6687b4819..034f2e883 100644 --- a/src/core/gnunet-service-core_sessions.c +++ b/src/core/gnunet-service-core_sessions.c | |||
@@ -57,6 +57,21 @@ struct SessionMessageEntry | |||
57 | struct SessionMessageEntry *prev; | 57 | struct SessionMessageEntry *prev; |
58 | 58 | ||
59 | /** | 59 | /** |
60 | * How important is this message. | ||
61 | */ | ||
62 | enum GNUNET_CORE_Priority priority; | ||
63 | |||
64 | /** | ||
65 | * Flag set to #GNUNET_YES if this is a typemap message. | ||
66 | */ | ||
67 | int is_typemap; | ||
68 | |||
69 | /** | ||
70 | * Flag set to #GNUNET_YES if this is a typemap confirmation message. | ||
71 | */ | ||
72 | int is_typemap_confirm; | ||
73 | |||
74 | /** | ||
60 | * Deadline for transmission, 1s after we received it (if we | 75 | * Deadline for transmission, 1s after we received it (if we |
61 | * are not corking), otherwise "now". Note that this message | 76 | * are not corking), otherwise "now". Note that this message |
62 | * does NOT expire past its deadline. | 77 | * does NOT expire past its deadline. |
@@ -70,11 +85,6 @@ struct SessionMessageEntry | |||
70 | */ | 85 | */ |
71 | size_t size; | 86 | size_t size; |
72 | 87 | ||
73 | /** | ||
74 | * How important is this message. | ||
75 | */ | ||
76 | enum GNUNET_CORE_Priority priority; | ||
77 | |||
78 | }; | 88 | }; |
79 | 89 | ||
80 | 90 | ||
@@ -275,14 +285,19 @@ transmit_typemap_task (void *cls) | |||
275 | struct GNUNET_MessageHeader *hdr; | 285 | struct GNUNET_MessageHeader *hdr; |
276 | struct GNUNET_TIME_Relative delay; | 286 | struct GNUNET_TIME_Relative delay; |
277 | 287 | ||
288 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
289 | "Sending TYPEMAP to %s\n", | ||
290 | GNUNET_i2s (session->peer)); | ||
278 | session->typemap_delay = GNUNET_TIME_STD_BACKOFF (session->typemap_delay); | 291 | session->typemap_delay = GNUNET_TIME_STD_BACKOFF (session->typemap_delay); |
279 | delay = session->typemap_delay; | 292 | delay = session->typemap_delay; |
280 | /* randomize a bit to avoid spont. sync */ | 293 | /* randomize a bit to avoid spont. sync */ |
281 | delay.rel_value_us += | 294 | delay.rel_value_us += |
282 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000 * 1000); | 295 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
296 | 1000 * 1000); | ||
283 | session->typemap_task = | 297 | session->typemap_task = |
284 | GNUNET_SCHEDULER_add_delayed (delay, | 298 | GNUNET_SCHEDULER_add_delayed (delay, |
285 | &transmit_typemap_task, session); | 299 | &transmit_typemap_task, |
300 | session); | ||
286 | GNUNET_STATISTICS_update (GSC_stats, | 301 | GNUNET_STATISTICS_update (GSC_stats, |
287 | gettext_noop ("# type map refreshes sent"), | 302 | gettext_noop ("# type map refreshes sent"), |
288 | 1, | 303 | 1, |
@@ -326,7 +341,7 @@ GSC_SESSIONS_create (const struct GNUNET_PeerIdentity *peer, | |||
326 | struct Session *session; | 341 | struct Session *session; |
327 | 342 | ||
328 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 343 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
329 | "Creating session for peer `%4s'\n", | 344 | "Creating session for peer `%s'\n", |
330 | GNUNET_i2s (peer)); | 345 | GNUNET_i2s (peer)); |
331 | session = GNUNET_new (struct Session); | 346 | session = GNUNET_new (struct Session); |
332 | session->tmap = GSC_TYPEMAP_create (); | 347 | session->tmap = GSC_TYPEMAP_create (); |
@@ -406,8 +421,14 @@ GSC_SESSIONS_confirm_typemap (const struct GNUNET_PeerIdentity *peer, | |||
406 | gettext_noop | 421 | gettext_noop |
407 | ("# outdated typemap confirmations received"), | 422 | ("# outdated typemap confirmations received"), |
408 | 1, GNUNET_NO); | 423 | 1, GNUNET_NO); |
424 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
425 | "Got outdated typemap confirmated from peer `%s'\n", | ||
426 | GNUNET_i2s (session->peer)); | ||
409 | return; | 427 | return; |
410 | } | 428 | } |
429 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
430 | "Got typemap confirmation from peer `%s'\n", | ||
431 | GNUNET_i2s (session->peer)); | ||
411 | if (NULL != session->typemap_task) | 432 | if (NULL != session->typemap_task) |
412 | { | 433 | { |
413 | GNUNET_SCHEDULER_cancel (session->typemap_task); | 434 | GNUNET_SCHEDULER_cancel (session->typemap_task); |
@@ -502,9 +523,9 @@ GSC_SESSIONS_queue_request (struct GSC_ClientActiveRequest *car) | |||
502 | } | 523 | } |
503 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 524 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
504 | "Received client transmission request. queueing\n"); | 525 | "Received client transmission request. queueing\n"); |
505 | GNUNET_CONTAINER_DLL_insert (session->active_client_request_head, | 526 | GNUNET_CONTAINER_DLL_insert_tail (session->active_client_request_head, |
506 | session->active_client_request_tail, | 527 | session->active_client_request_tail, |
507 | car); | 528 | car); |
508 | try_transmission (session); | 529 | try_transmission (session); |
509 | } | 530 | } |
510 | 531 | ||
@@ -751,7 +772,15 @@ try_transmission (struct Session *session) | |||
751 | while ( (NULL != (pos = session->sme_head)) && | 772 | while ( (NULL != (pos = session->sme_head)) && |
752 | (used + pos->size <= msize) ) | 773 | (used + pos->size <= msize) ) |
753 | { | 774 | { |
754 | GNUNET_memcpy (&pbuf[used], &pos[1], pos->size); | 775 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
776 | "Adding message of type %d (%d/%d) to payload for %s\n", | ||
777 | ntohs (((const struct GNUNET_MessageHeader *)&pos[1])->type), | ||
778 | pos->is_typemap, | ||
779 | pos->is_typemap_confirm, | ||
780 | GNUNET_i2s (session->peer)); | ||
781 | GNUNET_memcpy (&pbuf[used], | ||
782 | &pos[1], | ||
783 | pos->size); | ||
755 | used += pos->size; | 784 | used += pos->size; |
756 | GNUNET_CONTAINER_DLL_remove (session->sme_head, | 785 | GNUNET_CONTAINER_DLL_remove (session->sme_head, |
757 | session->sme_tail, | 786 | session->sme_tail, |
@@ -799,8 +828,23 @@ do_restart_typemap_message (void *cls, | |||
799 | struct SessionMessageEntry *sme; | 828 | struct SessionMessageEntry *sme; |
800 | uint16_t size; | 829 | uint16_t size; |
801 | 830 | ||
831 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
832 | "Restarting sending TYPEMAP to %s\n", | ||
833 | GNUNET_i2s (session->peer)); | ||
802 | size = ntohs (hdr->size); | 834 | size = ntohs (hdr->size); |
835 | for (sme = session->sme_head; NULL != sme; sme = sme->next) | ||
836 | { | ||
837 | if (GNUNET_YES == sme->is_typemap) | ||
838 | { | ||
839 | GNUNET_CONTAINER_DLL_remove (session->sme_head, | ||
840 | session->sme_tail, | ||
841 | sme); | ||
842 | GNUNET_free (sme); | ||
843 | break; | ||
844 | } | ||
845 | } | ||
803 | sme = GNUNET_malloc (sizeof (struct SessionMessageEntry) + size); | 846 | sme = GNUNET_malloc (sizeof (struct SessionMessageEntry) + size); |
847 | sme->is_typemap = GNUNET_YES; | ||
804 | GNUNET_memcpy (&sme[1], | 848 | GNUNET_memcpy (&sme[1], |
805 | hdr, | 849 | hdr, |
806 | size); | 850 | size); |
@@ -924,18 +968,36 @@ GSC_SESSIONS_set_typemap (const struct GNUNET_PeerIdentity *peer, | |||
924 | 968 | ||
925 | nmap = GSC_TYPEMAP_get_from_message (msg); | 969 | nmap = GSC_TYPEMAP_get_from_message (msg); |
926 | if (NULL == nmap) | 970 | if (NULL == nmap) |
971 | { | ||
972 | GNUNET_break_op (0); | ||
927 | return; /* malformed */ | 973 | return; /* malformed */ |
974 | } | ||
928 | session = find_session (peer); | 975 | session = find_session (peer); |
929 | if (NULL == session) | 976 | if (NULL == session) |
930 | { | 977 | { |
931 | GNUNET_break (0); | 978 | GNUNET_break (0); |
932 | return; | 979 | return; |
933 | } | 980 | } |
981 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
982 | "Received TYPEMAP from %s\n", | ||
983 | GNUNET_i2s (session->peer)); | ||
984 | for (sme = session->sme_head; NULL != sme; sme = sme->next) | ||
985 | { | ||
986 | if (GNUNET_YES == sme->is_typemap_confirm) | ||
987 | { | ||
988 | GNUNET_CONTAINER_DLL_remove (session->sme_head, | ||
989 | session->sme_tail, | ||
990 | sme); | ||
991 | GNUNET_free (sme); | ||
992 | break; | ||
993 | } | ||
994 | } | ||
934 | sme = GNUNET_malloc (sizeof (struct SessionMessageEntry) + | 995 | sme = GNUNET_malloc (sizeof (struct SessionMessageEntry) + |
935 | sizeof (struct TypeMapConfirmationMessage)); | 996 | sizeof (struct TypeMapConfirmationMessage)); |
936 | sme->deadline = GNUNET_TIME_absolute_get (); | 997 | sme->deadline = GNUNET_TIME_absolute_get (); |
937 | sme->size = sizeof (struct TypeMapConfirmationMessage); | 998 | sme->size = sizeof (struct TypeMapConfirmationMessage); |
938 | sme->priority = GNUNET_CORE_PRIO_CRITICAL_CONTROL; | 999 | sme->priority = GNUNET_CORE_PRIO_CRITICAL_CONTROL; |
1000 | sme->is_typemap_confirm = GNUNET_YES; | ||
939 | tmc = (struct TypeMapConfirmationMessage *) &sme[1]; | 1001 | tmc = (struct TypeMapConfirmationMessage *) &sme[1]; |
940 | tmc->header.size = htons (sizeof (struct TypeMapConfirmationMessage)); | 1002 | tmc->header.size = htons (sizeof (struct TypeMapConfirmationMessage)); |
941 | tmc->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_CONFIRM_TYPE_MAP); | 1003 | tmc->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_CONFIRM_TYPE_MAP); |
@@ -975,11 +1037,15 @@ GSC_SESSIONS_add_to_typemap (const struct GNUNET_PeerIdentity *peer, | |||
975 | return; | 1037 | return; |
976 | session = find_session (peer); | 1038 | session = find_session (peer); |
977 | GNUNET_assert (NULL != session); | 1039 | GNUNET_assert (NULL != session); |
978 | if (GNUNET_YES == GSC_TYPEMAP_test_match (session->tmap, &type, 1)) | 1040 | if (GNUNET_YES == GSC_TYPEMAP_test_match (session->tmap, |
1041 | &type, 1)) | ||
979 | return; /* already in it */ | 1042 | return; /* already in it */ |
980 | nmap = GSC_TYPEMAP_extend (session->tmap, &type, 1); | 1043 | nmap = GSC_TYPEMAP_extend (session->tmap, |
1044 | &type, | ||
1045 | 1); | ||
981 | GSC_CLIENTS_notify_clients_about_neighbour (peer, | 1046 | GSC_CLIENTS_notify_clients_about_neighbour (peer, |
982 | session->tmap, nmap); | 1047 | session->tmap, |
1048 | nmap); | ||
983 | GSC_TYPEMAP_destroy (session->tmap); | 1049 | GSC_TYPEMAP_destroy (session->tmap); |
984 | session->tmap = nmap; | 1050 | session->tmap = nmap; |
985 | } | 1051 | } |
diff --git a/src/core/gnunet-service-core_typemap.c b/src/core/gnunet-service-core_typemap.c index d400c0b8b..0600f59ef 100644 --- a/src/core/gnunet-service-core_typemap.c +++ b/src/core/gnunet-service-core_typemap.c | |||
@@ -177,8 +177,10 @@ GSC_TYPEMAP_get_from_message (const struct GNUNET_MessageHeader *msg) | |||
177 | GNUNET_memcpy (ret, &msg[1], sizeof (struct GSC_TypeMap)); | 177 | GNUNET_memcpy (ret, &msg[1], sizeof (struct GSC_TypeMap)); |
178 | return ret; | 178 | return ret; |
179 | case GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP: | 179 | case GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP: |
180 | GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# type maps received"), | 180 | GNUNET_STATISTICS_update (GSC_stats, |
181 | 1, GNUNET_NO); | 181 | gettext_noop ("# type maps received"), |
182 | 1, | ||
183 | GNUNET_NO); | ||
182 | ret = GNUNET_new (struct GSC_TypeMap); | 184 | ret = GNUNET_new (struct GSC_TypeMap); |
183 | dlen = sizeof (struct GSC_TypeMap); | 185 | dlen = sizeof (struct GSC_TypeMap); |
184 | if ((Z_OK != | 186 | if ((Z_OK != |
@@ -207,7 +209,8 @@ broadcast_my_type_map () | |||
207 | 209 | ||
208 | hdr = GSC_TYPEMAP_compute_type_map_message (); | 210 | hdr = GSC_TYPEMAP_compute_type_map_message (); |
209 | GNUNET_STATISTICS_update (GSC_stats, | 211 | GNUNET_STATISTICS_update (GSC_stats, |
210 | gettext_noop ("# updates to my type map"), 1, | 212 | gettext_noop ("# updates to my type map"), |
213 | 1, | ||
211 | GNUNET_NO); | 214 | GNUNET_NO); |
212 | GSC_SESSIONS_broadcast_typemap (hdr); | 215 | GSC_SESSIONS_broadcast_typemap (hdr); |
213 | GNUNET_free (hdr); | 216 | GNUNET_free (hdr); |
@@ -238,6 +241,8 @@ GSC_TYPEMAP_add (const uint16_t *types, | |||
238 | } | 241 | } |
239 | if (GNUNET_YES == changed) | 242 | if (GNUNET_YES == changed) |
240 | { | 243 | { |
244 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
245 | "Typemap changed, broadcasting!\n"); | ||
241 | rehash_typemap (); | 246 | rehash_typemap (); |
242 | broadcast_my_type_map (); | 247 | broadcast_my_type_map (); |
243 | } | 248 | } |
@@ -254,11 +259,10 @@ void | |||
254 | GSC_TYPEMAP_remove (const uint16_t *types, | 259 | GSC_TYPEMAP_remove (const uint16_t *types, |
255 | unsigned int tlen) | 260 | unsigned int tlen) |
256 | { | 261 | { |
257 | unsigned int i; | ||
258 | int changed; | 262 | int changed; |
259 | 263 | ||
260 | changed = GNUNET_NO; | 264 | changed = GNUNET_NO; |
261 | for (i = 0; i < tlen; i++) | 265 | for (unsigned int i = 0; i < tlen; i++) |
262 | { | 266 | { |
263 | if (0 == --map_counters[types[i]]) | 267 | if (0 == --map_counters[types[i]]) |
264 | { | 268 | { |
@@ -288,13 +292,11 @@ GSC_TYPEMAP_test_match (const struct GSC_TypeMap *tmap, | |||
288 | const uint16_t *types, | 292 | const uint16_t *types, |
289 | unsigned int tcnt) | 293 | unsigned int tcnt) |
290 | { | 294 | { |
291 | unsigned int i; | ||
292 | |||
293 | if (NULL == tmap) | 295 | if (NULL == tmap) |
294 | return GNUNET_NO; | 296 | return GNUNET_NO; |
295 | if (0 == tcnt) | 297 | if (0 == tcnt) |
296 | return GNUNET_YES; /* matches all */ | 298 | return GNUNET_YES; /* matches all */ |
297 | for (i = 0; i < tcnt; i++) | 299 | for (unsigned int i = 0; i < tcnt; i++) |
298 | if (0 != (tmap->bits[types[i] / 32] & (1 << (types[i] % 32)))) | 300 | if (0 != (tmap->bits[types[i] / 32] & (1 << (types[i] % 32)))) |
299 | return GNUNET_YES; | 301 | return GNUNET_YES; |
300 | return GNUNET_NO; | 302 | return GNUNET_NO; |
@@ -315,12 +317,11 @@ GSC_TYPEMAP_extend (const struct GSC_TypeMap *tmap, | |||
315 | unsigned int tcnt) | 317 | unsigned int tcnt) |
316 | { | 318 | { |
317 | struct GSC_TypeMap *ret; | 319 | struct GSC_TypeMap *ret; |
318 | unsigned int i; | ||
319 | 320 | ||
320 | ret = GNUNET_new (struct GSC_TypeMap); | 321 | ret = GNUNET_new (struct GSC_TypeMap); |
321 | if (NULL != tmap) | 322 | if (NULL != tmap) |
322 | GNUNET_memcpy (ret, tmap, sizeof (struct GSC_TypeMap)); | 323 | GNUNET_memcpy (ret, tmap, sizeof (struct GSC_TypeMap)); |
323 | for (i = 0; i < tcnt; i++) | 324 | for (unsigned int i = 0; i < tcnt; i++) |
324 | ret->bits[types[i] / 32] |= (1 << (types[i] % 32)); | 325 | ret->bits[types[i] / 32] |= (1 << (types[i] % 32)); |
325 | return ret; | 326 | return ret; |
326 | } | 327 | } |
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index fd8493e5f..76132523b 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1271,10 +1271,7 @@ udp_plugin_check_address (void *cls, | |||
1271 | 1271 | ||
1272 | v6 = (const struct IPv6UdpAddress *) addr; | 1272 | v6 = (const struct IPv6UdpAddress *) addr; |
1273 | if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) | 1273 | if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) |
1274 | { | 1274 | return GNUNET_OK; /* plausible, if unlikely... */ |
1275 | GNUNET_break_op (0); | ||
1276 | return GNUNET_SYSERR; | ||
1277 | } | ||
1278 | memset (&s6, 0, sizeof (s6)); | 1275 | memset (&s6, 0, sizeof (s6)); |
1279 | s6.sin6_family = AF_INET6; | 1276 | s6.sin6_family = AF_INET6; |
1280 | #if HAVE_SOCKADDR_IN_SIN_LEN | 1277 | #if HAVE_SOCKADDR_IN_SIN_LEN |
@@ -1338,10 +1335,7 @@ udp_nat_port_map_callback (void *cls, | |||
1338 | GNUNET_assert (sizeof(struct sockaddr_in) == addrlen); | 1335 | GNUNET_assert (sizeof(struct sockaddr_in) == addrlen); |
1339 | i4 = (const struct sockaddr_in *) addr; | 1336 | i4 = (const struct sockaddr_in *) addr; |
1340 | if (0 == ntohs (i4->sin_port)) | 1337 | if (0 == ntohs (i4->sin_port)) |
1341 | { | 1338 | return; /* Port = 0 means unmapped, ignore these for UDP. */ |
1342 | GNUNET_break (0); | ||
1343 | return; | ||
1344 | } | ||
1345 | memset (&u4, | 1339 | memset (&u4, |
1346 | 0, | 1340 | 0, |
1347 | sizeof(u4)); | 1341 | sizeof(u4)); |
@@ -1359,10 +1353,7 @@ udp_nat_port_map_callback (void *cls, | |||
1359 | GNUNET_assert (sizeof(struct sockaddr_in6) == addrlen); | 1353 | GNUNET_assert (sizeof(struct sockaddr_in6) == addrlen); |
1360 | i6 = (const struct sockaddr_in6 *) addr; | 1354 | i6 = (const struct sockaddr_in6 *) addr; |
1361 | if (0 == ntohs (i6->sin6_port)) | 1355 | if (0 == ntohs (i6->sin6_port)) |
1362 | { | 1356 | return; /* Port = 0 means unmapped, ignore these for UDP. */ |
1363 | GNUNET_break (0); | ||
1364 | return; | ||
1365 | } | ||
1366 | memset (&u6, | 1357 | memset (&u6, |
1367 | 0, | 1358 | 0, |
1368 | sizeof(u6)); | 1359 | sizeof(u6)); |
diff --git a/src/transport/transport_api_core.c b/src/transport/transport_api_core.c index a693cb889..c99ade92f 100644 --- a/src/transport/transport_api_core.c +++ b/src/transport/transport_api_core.c | |||
@@ -447,7 +447,8 @@ mq_send_impl (struct GNUNET_MQ_Handle *mq, | |||
447 | GNUNET_MQ_send (h->mq, | 447 | GNUNET_MQ_send (h->mq, |
448 | n->env); | 448 | n->env); |
449 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 449 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
450 | "Queued message for neighbour `%s'.\n", | 450 | "Queued message of type %u for neighbour `%s'.\n", |
451 | ntohs (msg->type), | ||
451 | GNUNET_i2s (&n->id)); | 452 | GNUNET_i2s (&n->id)); |
452 | } | 453 | } |
453 | 454 | ||