diff options
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index f38c08c65..d382b5108 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -155,7 +155,7 @@ struct Plugin; | |||
155 | */ | 155 | */ |
156 | struct LocalAddrList | 156 | struct LocalAddrList |
157 | { | 157 | { |
158 | 158 | ||
159 | /** | 159 | /** |
160 | * This is a doubly linked list. | 160 | * This is a doubly linked list. |
161 | */ | 161 | */ |
@@ -393,10 +393,10 @@ struct Plugin | |||
393 | * List of our IP addresses. | 393 | * List of our IP addresses. |
394 | */ | 394 | */ |
395 | struct LocalAddrList *lal_head; | 395 | struct LocalAddrList *lal_head; |
396 | 396 | ||
397 | /** | 397 | /** |
398 | * Tail of our IP address list. | 398 | * Tail of our IP address list. |
399 | */ | 399 | */ |
400 | struct LocalAddrList *lal_tail; | 400 | struct LocalAddrList *lal_tail; |
401 | 401 | ||
402 | /** | 402 | /** |
@@ -480,16 +480,16 @@ check_local_addr (struct Plugin *plugin, | |||
480 | 480 | ||
481 | /** | 481 | /** |
482 | * Function called for a quick conversion of the binary address to | 482 | * Function called for a quick conversion of the binary address to |
483 | * a numeric address. Note that the caller must not free the | 483 | * a numeric address. Note that the caller must not free the |
484 | * address and that the next call to this function is allowed | 484 | * address and that the next call to this function is allowed |
485 | * to override the address again. | 485 | * to override the address again. |
486 | * | 486 | * |
487 | * @param cls closure ('struct Plugin*') | 487 | * @param cls closure ('struct Plugin*') |
488 | * @param addr binary address | 488 | * @param addr binary address |
489 | * @param addrlen length of the address | 489 | * @param addrlen length of the address |
490 | * @return string representing the same address | 490 | * @return string representing the same address |
491 | */ | 491 | */ |
492 | static const char* | 492 | static const char* |
493 | tcp_address_to_string (void *cls, | 493 | tcp_address_to_string (void *cls, |
494 | const void *addr, | 494 | const void *addr, |
495 | size_t addrlen) | 495 | size_t addrlen) |
@@ -611,7 +611,7 @@ create_session (struct Plugin *plugin, | |||
611 | GNUNET_STATISTICS_update (plugin->env->stats, | 611 | GNUNET_STATISTICS_update (plugin->env->stats, |
612 | gettext_noop ("# bytes currently in TCP buffers"), | 612 | gettext_noop ("# bytes currently in TCP buffers"), |
613 | pm->message_size, | 613 | pm->message_size, |
614 | GNUNET_NO); | 614 | GNUNET_NO); |
615 | GNUNET_CONTAINER_DLL_insert (ret->pending_messages_head, | 615 | GNUNET_CONTAINER_DLL_insert (ret->pending_messages_head, |
616 | ret->pending_messages_tail, | 616 | ret->pending_messages_tail, |
617 | pm); | 617 | pm); |
@@ -689,7 +689,7 @@ do_transmit (void *cls, size_t size, void *buf) | |||
689 | /* do this call before callbacks (so that if callbacks destroy | 689 | /* do this call before callbacks (so that if callbacks destroy |
690 | session, they have a chance to cancel actions done by this | 690 | session, they have a chance to cancel actions done by this |
691 | call) */ | 691 | call) */ |
692 | process_pending_messages (session); | 692 | process_pending_messages (session); |
693 | pid = session->target; | 693 | pid = session->target; |
694 | /* no do callbacks and do not use session again since | 694 | /* no do callbacks and do not use session again since |
695 | the callbacks may abort the session */ | 695 | the callbacks may abort the session */ |
@@ -704,11 +704,11 @@ do_transmit (void *cls, size_t size, void *buf) | |||
704 | GNUNET_STATISTICS_update (plugin->env->stats, | 704 | GNUNET_STATISTICS_update (plugin->env->stats, |
705 | gettext_noop ("# bytes currently in TCP buffers"), | 705 | gettext_noop ("# bytes currently in TCP buffers"), |
706 | - (int64_t) ret, | 706 | - (int64_t) ret, |
707 | GNUNET_NO); | 707 | GNUNET_NO); |
708 | GNUNET_STATISTICS_update (plugin->env->stats, | 708 | GNUNET_STATISTICS_update (plugin->env->stats, |
709 | gettext_noop ("# bytes discarded by TCP (timeout)"), | 709 | gettext_noop ("# bytes discarded by TCP (timeout)"), |
710 | ret, | 710 | ret, |
711 | GNUNET_NO); | 711 | GNUNET_NO); |
712 | return 0; | 712 | return 0; |
713 | } | 713 | } |
714 | /* copy all pending messages that would fit */ | 714 | /* copy all pending messages that would fit */ |
@@ -716,9 +716,9 @@ do_transmit (void *cls, size_t size, void *buf) | |||
716 | cbuf = buf; | 716 | cbuf = buf; |
717 | hd = NULL; | 717 | hd = NULL; |
718 | tl = NULL; | 718 | tl = NULL; |
719 | while (NULL != (pos = session->pending_messages_head)) | 719 | while (NULL != (pos = session->pending_messages_head)) |
720 | { | 720 | { |
721 | if (ret + pos->message_size > size) | 721 | if (ret + pos->message_size > size) |
722 | break; | 722 | break; |
723 | GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, | 723 | GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, |
724 | session->pending_messages_tail, | 724 | session->pending_messages_tail, |
@@ -734,7 +734,7 @@ do_transmit (void *cls, size_t size, void *buf) | |||
734 | /* schedule 'continuation' before callbacks so that callbacks that | 734 | /* schedule 'continuation' before callbacks so that callbacks that |
735 | cancel everything don't cause us to use a session that no longer | 735 | cancel everything don't cause us to use a session that no longer |
736 | exists... */ | 736 | exists... */ |
737 | process_pending_messages (session); | 737 | process_pending_messages (session); |
738 | session->last_activity = GNUNET_TIME_absolute_get (); | 738 | session->last_activity = GNUNET_TIME_absolute_get (); |
739 | pid = session->target; | 739 | pid = session->target; |
740 | /* we'll now call callbacks that may cancel the session; hence | 740 | /* we'll now call callbacks that may cancel the session; hence |
@@ -756,11 +756,11 @@ do_transmit (void *cls, size_t size, void *buf) | |||
756 | GNUNET_STATISTICS_update (plugin->env->stats, | 756 | GNUNET_STATISTICS_update (plugin->env->stats, |
757 | gettext_noop ("# bytes currently in TCP buffers"), | 757 | gettext_noop ("# bytes currently in TCP buffers"), |
758 | - (int64_t) ret, | 758 | - (int64_t) ret, |
759 | GNUNET_NO); | 759 | GNUNET_NO); |
760 | GNUNET_STATISTICS_update (plugin->env->stats, | 760 | GNUNET_STATISTICS_update (plugin->env->stats, |
761 | gettext_noop ("# bytes transmitted via TCP"), | 761 | gettext_noop ("# bytes transmitted via TCP"), |
762 | ret, | 762 | ret, |
763 | GNUNET_NO); | 763 | GNUNET_NO); |
764 | return ret; | 764 | return ret; |
765 | } | 765 | } |
766 | 766 | ||
@@ -812,7 +812,7 @@ disconnect_session (struct Session *session) | |||
812 | (session->connect_addr != NULL) ? | 812 | (session->connect_addr != NULL) ? |
813 | tcp_address_to_string (session->plugin, | 813 | tcp_address_to_string (session->plugin, |
814 | session->connect_addr, | 814 | session->connect_addr, |
815 | session->connect_alen) : "*", | 815 | session->connect_alen) : "*", |
816 | session); | 816 | session); |
817 | #endif | 817 | #endif |
818 | /* remove from session list */ | 818 | /* remove from session list */ |
@@ -851,11 +851,11 @@ disconnect_session (struct Session *session) | |||
851 | GNUNET_STATISTICS_update (session->plugin->env->stats, | 851 | GNUNET_STATISTICS_update (session->plugin->env->stats, |
852 | gettext_noop ("# bytes currently in TCP buffers"), | 852 | gettext_noop ("# bytes currently in TCP buffers"), |
853 | - (int64_t) pm->message_size, | 853 | - (int64_t) pm->message_size, |
854 | GNUNET_NO); | 854 | GNUNET_NO); |
855 | GNUNET_STATISTICS_update (session->plugin->env->stats, | 855 | GNUNET_STATISTICS_update (session->plugin->env->stats, |
856 | gettext_noop ("# bytes discarded by TCP (disconnect)"), | 856 | gettext_noop ("# bytes discarded by TCP (disconnect)"), |
857 | pm->message_size, | 857 | pm->message_size, |
858 | GNUNET_NO); | 858 | GNUNET_NO); |
859 | GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, | 859 | GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, |
860 | session->pending_messages_tail, | 860 | session->pending_messages_tail, |
861 | pm); | 861 | pm); |
@@ -870,15 +870,15 @@ disconnect_session (struct Session *session) | |||
870 | GNUNET_SCHEDULER_cancel (session->plugin->env->sched, | 870 | GNUNET_SCHEDULER_cancel (session->plugin->env->sched, |
871 | session->receive_delay_task); | 871 | session->receive_delay_task); |
872 | if (session->client != NULL) | 872 | if (session->client != NULL) |
873 | GNUNET_SERVER_receive_done (session->client, | 873 | GNUNET_SERVER_receive_done (session->client, |
874 | GNUNET_SYSERR); | 874 | GNUNET_SYSERR); |
875 | } | 875 | } |
876 | if (session->client != NULL) | 876 | if (session->client != NULL) |
877 | GNUNET_SERVER_client_drop (session->client); | 877 | GNUNET_SERVER_client_drop (session->client); |
878 | GNUNET_STATISTICS_update (session->plugin->env->stats, | 878 | GNUNET_STATISTICS_update (session->plugin->env->stats, |
879 | gettext_noop ("# TCP sessions active"), | 879 | gettext_noop ("# TCP sessions active"), |
880 | -1, | 880 | -1, |
881 | GNUNET_NO); | 881 | GNUNET_NO); |
882 | GNUNET_free_non_null (session->connect_addr); | 882 | GNUNET_free_non_null (session->connect_addr); |
883 | GNUNET_free (session); | 883 | GNUNET_free (session); |
884 | } | 884 | } |
@@ -886,7 +886,7 @@ disconnect_session (struct Session *session) | |||
886 | 886 | ||
887 | /** | 887 | /** |
888 | * Given two otherwise equivalent sessions, pick the better one. | 888 | * Given two otherwise equivalent sessions, pick the better one. |
889 | * | 889 | * |
890 | * @param s1 one session (also default) | 890 | * @param s1 one session (also default) |
891 | * @param s2 other session | 891 | * @param s2 other session |
892 | * @return "better" session (more active) | 892 | * @return "better" session (more active) |
@@ -1043,7 +1043,7 @@ tcp_plugin_send (void *cls, | |||
1043 | GNUNET_STATISTICS_update (plugin->env->stats, | 1043 | GNUNET_STATISTICS_update (plugin->env->stats, |
1044 | gettext_noop ("# bytes TCP was asked to transmit"), | 1044 | gettext_noop ("# bytes TCP was asked to transmit"), |
1045 | msgbuf_size, | 1045 | msgbuf_size, |
1046 | GNUNET_NO); | 1046 | GNUNET_NO); |
1047 | /* FIXME: we could do this cheaper with a hash table | 1047 | /* FIXME: we could do this cheaper with a hash table |
1048 | where we could restrict the iteration to entries that match | 1048 | where we could restrict the iteration to entries that match |
1049 | the target peer... */ | 1049 | the target peer... */ |
@@ -1052,17 +1052,17 @@ tcp_plugin_send (void *cls, | |||
1052 | { | 1052 | { |
1053 | cand_session = NULL; | 1053 | cand_session = NULL; |
1054 | next = plugin->sessions; | 1054 | next = plugin->sessions; |
1055 | while (NULL != (session = next)) | 1055 | while (NULL != (session = next)) |
1056 | { | 1056 | { |
1057 | next = session->next; | 1057 | next = session->next; |
1058 | GNUNET_assert (session->client != NULL); | 1058 | GNUNET_assert (session->client != NULL); |
1059 | if (0 != memcmp (target, | 1059 | if (0 != memcmp (target, |
1060 | &session->target, | 1060 | &session->target, |
1061 | sizeof (struct GNUNET_PeerIdentity))) | 1061 | sizeof (struct GNUNET_PeerIdentity))) |
1062 | continue; | 1062 | continue; |
1063 | if ( ( (GNUNET_SYSERR == force_address) && | 1063 | if ( ( (GNUNET_SYSERR == force_address) && |
1064 | (session->expecting_welcome == GNUNET_NO) ) || | 1064 | (session->expecting_welcome == GNUNET_NO) ) || |
1065 | (GNUNET_NO == force_address) ) | 1065 | (GNUNET_NO == force_address) ) |
1066 | { | 1066 | { |
1067 | cand_session = select_better_session (cand_session, | 1067 | cand_session = select_better_session (cand_session, |
1068 | session); | 1068 | session); |
@@ -1076,7 +1076,7 @@ tcp_plugin_send (void *cls, | |||
1076 | GNUNET_break (0); | 1076 | GNUNET_break (0); |
1077 | break; | 1077 | break; |
1078 | } | 1078 | } |
1079 | if (session->inbound == GNUNET_YES) | 1079 | if (session->inbound == GNUNET_YES) |
1080 | continue; | 1080 | continue; |
1081 | if (addrlen != session->connect_alen) | 1081 | if (addrlen != session->connect_alen) |
1082 | continue; | 1082 | continue; |
@@ -1085,7 +1085,7 @@ tcp_plugin_send (void *cls, | |||
1085 | addrlen)) | 1085 | addrlen)) |
1086 | continue; | 1086 | continue; |
1087 | cand_session = select_better_session (cand_session, | 1087 | cand_session = select_better_session (cand_session, |
1088 | session); | 1088 | session); |
1089 | } | 1089 | } |
1090 | session = cand_session; | 1090 | session = cand_session; |
1091 | } | 1091 | } |
@@ -1100,7 +1100,7 @@ tcp_plugin_send (void *cls, | |||
1100 | GNUNET_STATISTICS_update (plugin->env->stats, | 1100 | GNUNET_STATISTICS_update (plugin->env->stats, |
1101 | gettext_noop ("# bytes discarded by TCP (no address and no connection)"), | 1101 | gettext_noop ("# bytes discarded by TCP (no address and no connection)"), |
1102 | msgbuf_size, | 1102 | msgbuf_size, |
1103 | GNUNET_NO); | 1103 | GNUNET_NO); |
1104 | return -1; | 1104 | return -1; |
1105 | } | 1105 | } |
1106 | if (session == NULL) | 1106 | if (session == NULL) |
@@ -1119,7 +1119,7 @@ tcp_plugin_send (void *cls, | |||
1119 | is_natd = GNUNET_YES; | 1119 | is_natd = GNUNET_YES; |
1120 | memcpy (&a6.sin6_addr, | 1120 | memcpy (&a6.sin6_addr, |
1121 | &t6->ipv6_addr, | 1121 | &t6->ipv6_addr, |
1122 | sizeof (struct in6_addr)); | 1122 | sizeof (struct in6_addr)); |
1123 | sb = &a6; | 1123 | sb = &a6; |
1124 | sbs = sizeof (a6); | 1124 | sbs = sizeof (a6); |
1125 | } | 1125 | } |
@@ -1167,8 +1167,8 @@ tcp_plugin_send (void *cls, | |||
1167 | pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size); | 1167 | pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size); |
1168 | /* FIXME: the memset of this malloc can be up to 2% of our total runtime */ | 1168 | /* FIXME: the memset of this malloc can be up to 2% of our total runtime */ |
1169 | pm->msg = (const char*) &pm[1]; | 1169 | pm->msg = (const char*) &pm[1]; |
1170 | memcpy (&pm[1], msg, msgbuf_size); | 1170 | memcpy (&pm[1], msg, msgbuf_size); |
1171 | /* FIXME: this memcpy can be up to 7% of our total run-time | 1171 | /* FIXME: this memcpy can be up to 7% of our total run-time |
1172 | (for transport service) */ | 1172 | (for transport service) */ |
1173 | pm->message_size = msgbuf_size; | 1173 | pm->message_size = msgbuf_size; |
1174 | pm->timeout = GNUNET_TIME_relative_to_absolute (timeout); | 1174 | pm->timeout = GNUNET_TIME_relative_to_absolute (timeout); |
@@ -1209,7 +1209,7 @@ tcp_plugin_send (void *cls, | |||
1209 | GNUNET_STATISTICS_update (plugin->env->stats, | 1209 | GNUNET_STATISTICS_update (plugin->env->stats, |
1210 | gettext_noop ("# bytes discarded by TCP (failed to connect)"), | 1210 | gettext_noop ("# bytes discarded by TCP (failed to connect)"), |
1211 | msgbuf_size, | 1211 | msgbuf_size, |
1212 | GNUNET_NO); | 1212 | GNUNET_NO); |
1213 | return -1; | 1213 | return -1; |
1214 | } | 1214 | } |
1215 | #if DEBUG_TCP | 1215 | #if DEBUG_TCP |
@@ -1233,7 +1233,7 @@ tcp_plugin_send (void *cls, | |||
1233 | GNUNET_STATISTICS_update (plugin->env->stats, | 1233 | GNUNET_STATISTICS_update (plugin->env->stats, |
1234 | gettext_noop ("# bytes currently in TCP buffers"), | 1234 | gettext_noop ("# bytes currently in TCP buffers"), |
1235 | msgbuf_size, | 1235 | msgbuf_size, |
1236 | GNUNET_NO); | 1236 | GNUNET_NO); |
1237 | /* create new message entry */ | 1237 | /* create new message entry */ |
1238 | pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size); | 1238 | pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size); |
1239 | pm->msg = (const char*) &pm[1]; | 1239 | pm->msg = (const char*) &pm[1]; |
@@ -1397,7 +1397,7 @@ tcp_plugin_address_pretty_printer (void *cls, | |||
1397 | a6.sin6_port = t6->t6_port; | 1397 | a6.sin6_port = t6->t6_port; |
1398 | memcpy (&a6.sin6_addr, | 1398 | memcpy (&a6.sin6_addr, |
1399 | &t6->ipv6_addr, | 1399 | &t6->ipv6_addr, |
1400 | sizeof (struct in6_addr)); | 1400 | sizeof (struct in6_addr)); |
1401 | port = ntohs (t6->t6_port); | 1401 | port = ntohs (t6->t6_port); |
1402 | sb = &a6; | 1402 | sb = &a6; |
1403 | sbs = sizeof (a6); | 1403 | sbs = sizeof (a6); |
@@ -1457,7 +1457,7 @@ check_port (struct Plugin *plugin, uint16_t in_port) | |||
1457 | } | 1457 | } |
1458 | 1458 | ||
1459 | 1459 | ||
1460 | /** | 1460 | /** |
1461 | * Function that will be called to check if a binary address for this | 1461 | * Function that will be called to check if a binary address for this |
1462 | * plugin is well-formed and corresponds to an address for THIS peer | 1462 | * plugin is well-formed and corresponds to an address for THIS peer |
1463 | * (as per our configuration). Naturally, if absolutely necessary, | 1463 | * (as per our configuration). Naturally, if absolutely necessary, |
@@ -1473,8 +1473,8 @@ check_port (struct Plugin *plugin, uint16_t in_port) | |||
1473 | * and transport, GNUNET_SYSERR if not | 1473 | * and transport, GNUNET_SYSERR if not |
1474 | */ | 1474 | */ |
1475 | static int | 1475 | static int |
1476 | tcp_plugin_check_address (void *cls, | 1476 | tcp_plugin_check_address (void *cls, |
1477 | const void *addr, | 1477 | const void *addr, |
1478 | size_t addrlen) | 1478 | size_t addrlen) |
1479 | { | 1479 | { |
1480 | struct Plugin *plugin = cls; | 1480 | struct Plugin *plugin = cls; |
@@ -1507,7 +1507,7 @@ tcp_plugin_check_address (void *cls, | |||
1507 | GNUNET_break_op (0); | 1507 | GNUNET_break_op (0); |
1508 | return GNUNET_SYSERR; | 1508 | return GNUNET_SYSERR; |
1509 | } | 1509 | } |
1510 | if (GNUNET_OK != | 1510 | if (GNUNET_OK != |
1511 | check_port (plugin, ntohs (v6->t6_port))) | 1511 | check_port (plugin, ntohs (v6->t6_port))) |
1512 | return GNUNET_SYSERR; | 1512 | return GNUNET_SYSERR; |
1513 | if (GNUNET_OK != | 1513 | if (GNUNET_OK != |
@@ -1661,14 +1661,14 @@ handle_tcp_welcome (void *cls, | |||
1661 | 1661 | ||
1662 | #if DEBUG_TCP | 1662 | #if DEBUG_TCP |
1663 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1663 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1664 | "Received %s message from a `%4s/%p'.\n", | 1664 | "Received %s message from a `%4s/%p'.\n", |
1665 | "WELCOME", | 1665 | "WELCOME", |
1666 | GNUNET_i2s (&wm->clientIdentity), client); | 1666 | GNUNET_i2s (&wm->clientIdentity), client); |
1667 | #endif | 1667 | #endif |
1668 | GNUNET_STATISTICS_update (plugin->env->stats, | 1668 | GNUNET_STATISTICS_update (plugin->env->stats, |
1669 | gettext_noop ("# TCP WELCOME messages received"), | 1669 | gettext_noop ("# TCP WELCOME messages received"), |
1670 | 1, | 1670 | 1, |
1671 | GNUNET_NO); | 1671 | GNUNET_NO); |
1672 | session = find_session_by_client (plugin, client); | 1672 | session = find_session_by_client (plugin, client); |
1673 | if (session == NULL) | 1673 | if (session == NULL) |
1674 | { | 1674 | { |
@@ -1749,13 +1749,13 @@ delayed_done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1749 | session->receive_delay_task = GNUNET_SCHEDULER_NO_TASK; | 1749 | session->receive_delay_task = GNUNET_SCHEDULER_NO_TASK; |
1750 | delay = session->plugin->env->receive (session->plugin->env->cls, | 1750 | delay = session->plugin->env->receive (session->plugin->env->cls, |
1751 | &session->target, | 1751 | &session->target, |
1752 | NULL, 0, | 1752 | NULL, 0, |
1753 | session, | 1753 | session, |
1754 | NULL, 0); | 1754 | NULL, 0); |
1755 | if (delay.value == 0) | 1755 | if (delay.value == 0) |
1756 | GNUNET_SERVER_receive_done (session->client, GNUNET_OK); | 1756 | GNUNET_SERVER_receive_done (session->client, GNUNET_OK); |
1757 | else | 1757 | else |
1758 | session->receive_delay_task = | 1758 | session->receive_delay_task = |
1759 | GNUNET_SCHEDULER_add_delayed (session->plugin->env->sched, | 1759 | GNUNET_SCHEDULER_add_delayed (session->plugin->env->sched, |
1760 | delay, &delayed_done, session); | 1760 | delay, &delayed_done, session); |
1761 | } | 1761 | } |
@@ -1782,8 +1782,8 @@ handle_tcp_data (void *cls, | |||
1782 | { | 1782 | { |
1783 | /* We don't want to propagate WELCOME and NAT Probe messages up! */ | 1783 | /* We don't want to propagate WELCOME and NAT Probe messages up! */ |
1784 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 1784 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
1785 | return; | 1785 | return; |
1786 | } | 1786 | } |
1787 | session = find_session_by_client (plugin, client); | 1787 | session = find_session_by_client (plugin, client); |
1788 | if ( (NULL == session) || (GNUNET_YES == session->expecting_welcome)) | 1788 | if ( (NULL == session) || (GNUNET_YES == session->expecting_welcome)) |
1789 | { | 1789 | { |
@@ -1794,22 +1794,22 @@ handle_tcp_data (void *cls, | |||
1794 | #if DEBUG_TCP | 1794 | #if DEBUG_TCP |
1795 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1795 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1796 | "Passing %u bytes of type %u from `%4s' to transport service.\n", | 1796 | "Passing %u bytes of type %u from `%4s' to transport service.\n", |
1797 | (unsigned int) ntohs (message->size), | 1797 | (unsigned int) ntohs (message->size), |
1798 | (unsigned int) ntohs (message->type), | 1798 | (unsigned int) ntohs (message->type), |
1799 | GNUNET_i2s (&session->target)); | 1799 | GNUNET_i2s (&session->target)); |
1800 | #endif | 1800 | #endif |
1801 | GNUNET_STATISTICS_update (plugin->env->stats, | 1801 | GNUNET_STATISTICS_update (plugin->env->stats, |
1802 | gettext_noop ("# bytes received via TCP"), | 1802 | gettext_noop ("# bytes received via TCP"), |
1803 | ntohs (message->size), | 1803 | ntohs (message->size), |
1804 | GNUNET_NO); | 1804 | GNUNET_NO); |
1805 | delay = plugin->env->receive (plugin->env->cls, &session->target, message, 1, | 1805 | delay = plugin->env->receive (plugin->env->cls, &session->target, message, 1, |
1806 | session, | 1806 | session, |
1807 | (GNUNET_YES == session->inbound) ? NULL : session->connect_addr, | 1807 | (GNUNET_YES == session->inbound) ? NULL : session->connect_addr, |
1808 | (GNUNET_YES == session->inbound) ? 0 : session->connect_alen); | 1808 | (GNUNET_YES == session->inbound) ? 0 : session->connect_alen); |
1809 | if (delay.value == 0) | 1809 | if (delay.value == 0) |
1810 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 1810 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
1811 | else | 1811 | else |
1812 | session->receive_delay_task = | 1812 | session->receive_delay_task = |
1813 | GNUNET_SCHEDULER_add_delayed (session->plugin->env->sched, | 1813 | GNUNET_SCHEDULER_add_delayed (session->plugin->env->sched, |
1814 | delay, &delayed_done, session); | 1814 | delay, &delayed_done, session); |
1815 | } | 1815 | } |
@@ -1823,7 +1823,7 @@ handle_tcp_data (void *cls, | |||
1823 | * @param client identification of the client | 1823 | * @param client identification of the client |
1824 | */ | 1824 | */ |
1825 | static void | 1825 | static void |
1826 | disconnect_notify (void *cls, | 1826 | disconnect_notify (void *cls, |
1827 | struct GNUNET_SERVER_Client *client) | 1827 | struct GNUNET_SERVER_Client *client) |
1828 | { | 1828 | { |
1829 | struct Plugin *plugin = cls; | 1829 | struct Plugin *plugin = cls; |
@@ -2445,7 +2445,7 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
2445 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 2445 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
2446 | _("TCP transport advertises itself as being on port %llu\n"), | 2446 | _("TCP transport advertises itself as being on port %llu\n"), |
2447 | aport); | 2447 | aport); |
2448 | GNUNET_SERVER_disconnect_notify (plugin->server, | 2448 | GNUNET_SERVER_disconnect_notify (plugin->server, |
2449 | &disconnect_notify, | 2449 | &disconnect_notify, |
2450 | plugin); | 2450 | plugin); |
2451 | GNUNET_CONFIGURATION_get_value_string(env->cfg, "transport-tcp", "BINDTO", &plugin->bind_address); | 2451 | GNUNET_CONFIGURATION_get_value_string(env->cfg, "transport-tcp", "BINDTO", &plugin->bind_address); |