diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-10-18 12:51:27 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-10-18 12:51:27 +0000 |
commit | aadda4ec9d989fd49eea186420d4ea86b769dddd (patch) | |
tree | ee9a6aaf4f148afa2e858321518893ff6fa5cf6a /src | |
parent | 913d8769fe154d58be01f0f303b708850277edb5 (diff) | |
download | gnunet-aadda4ec9d989fd49eea186420d4ea86b769dddd.tar.gz gnunet-aadda4ec9d989fd49eea186420d4ea86b769dddd.zip |
new statistics
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/plugin_transport_udp.c | 283 |
1 files changed, 203 insertions, 80 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index b284328c8..69acb50fd 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -86,6 +86,16 @@ struct PrettyPrinterContext | |||
86 | }; | 86 | }; |
87 | 87 | ||
88 | 88 | ||
89 | enum UDP_MessageType | ||
90 | { | ||
91 | UNDEFINED = 0, | ||
92 | MSG_FRAGMENTED = 1, | ||
93 | MSG_FRAGMENTED_COMPLETE = 2, | ||
94 | MSG_UNFRAGMENTED = 3, | ||
95 | MSG_ACK = 4, | ||
96 | MSG_BEACON = 5 | ||
97 | }; | ||
98 | |||
89 | struct Session | 99 | struct Session |
90 | { | 100 | { |
91 | /** | 101 | /** |
@@ -301,6 +311,12 @@ struct UDP_MessageWrapper | |||
301 | struct UDP_MessageWrapper *next; | 311 | struct UDP_MessageWrapper *next; |
302 | 312 | ||
303 | /** | 313 | /** |
314 | * Message type | ||
315 | * According to UDP_MessageType | ||
316 | */ | ||
317 | int msg_type; | ||
318 | |||
319 | /** | ||
304 | * Message with size msg_size including UDP specific overhead | 320 | * Message with size msg_size including UDP specific overhead |
305 | */ | 321 | */ |
306 | char *msg_buf; | 322 | char *msg_buf; |
@@ -692,49 +708,156 @@ udp_plugin_address_pretty_printer (void *cls, const char *type, | |||
692 | static void | 708 | static void |
693 | call_continuation (struct UDP_MessageWrapper *udpw, int result) | 709 | call_continuation (struct UDP_MessageWrapper *udpw, int result) |
694 | { | 710 | { |
711 | size_t overhead; | ||
712 | |||
695 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 713 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
696 | "Calling continuation for %u byte message to `%s' with result %s\n", | 714 | "Calling continuation for %u byte message to `%s' with result %s\n", |
697 | udpw->payload_size, GNUNET_i2s (&udpw->session->target), | 715 | udpw->payload_size, GNUNET_i2s (&udpw->session->target), |
698 | (GNUNET_OK == result) ? "OK" : "SYSERR"); | 716 | (GNUNET_OK == result) ? "OK" : "SYSERR"); |
699 | 717 | ||
700 | if (NULL == udpw->frag_ctx) | 718 | if ((udpw->msg_size - udpw->payload_size) >= 0) |
701 | { | 719 | overhead = udpw->msg_size - udpw->payload_size; |
702 | /* Not fragmented message */ | 720 | else |
703 | if (GNUNET_OK == result) | 721 | overhead = udpw->msg_size; |
704 | { | 722 | |
705 | GNUNET_STATISTICS_update (plugin->env->stats, | 723 | switch (result) { |
706 | "# unfragmented messages transmit with success via UDP", | 724 | case GNUNET_OK: |
707 | 1, GNUNET_NO); | 725 | switch (udpw->msg_type) { |
708 | if (udpw->msg_size >= udpw->payload_size) | 726 | case MSG_UNFRAGMENTED: |
709 | { | 727 | if (NULL != udpw->cont) |
710 | GNUNET_STATISTICS_update (plugin->env->stats, | 728 | { |
711 | "# bytes overhead transmitted via UDP", | 729 | /* Transport continuation */ |
712 | udpw->msg_size - udpw->payload_size, GNUNET_NO); | 730 | udpw->cont (udpw->cont_cls, &udpw->session->target, result, |
713 | } | 731 | udpw->payload_size, overhead); |
714 | GNUNET_STATISTICS_update (plugin->env->stats, | 732 | } |
715 | "# bytes payload transmitted via UDP", | ||
716 | udpw->payload_size, GNUNET_NO); | ||
717 | } | ||
718 | else | ||
719 | { | ||
720 | GNUNET_STATISTICS_update (plugin->env->stats, | 733 | GNUNET_STATISTICS_update (plugin->env->stats, |
721 | "# unfragmented messages transmit with failure via UDP", | 734 | "# UDP, unfragmented msgs, messages, sent, success", |
722 | 1, GNUNET_NO); | 735 | 1, GNUNET_NO); |
723 | } | 736 | GNUNET_STATISTICS_update (plugin->env->stats, |
724 | if (NULL != udpw->cont) | 737 | "# UDP, unfragmented msgs, bytes payload, sent, success", |
725 | udpw->cont (udpw->cont_cls, &udpw->session->target, result, | 738 | udpw->payload_size, GNUNET_NO); |
726 | udpw->payload_size, udpw->msg_size); | 739 | GNUNET_STATISTICS_update (plugin->env->stats, |
727 | } | 740 | "# UDP, unfragmented msgs, bytes overhead, sent, success", |
728 | else | 741 | overhead, GNUNET_NO); |
729 | { | 742 | GNUNET_STATISTICS_update (plugin->env->stats, |
730 | /* Fragmented message */ | 743 | "# UDP, total, bytes overhead, sent", |
731 | if (GNUNET_OK == result) | 744 | overhead, GNUNET_NO); |
732 | { | 745 | GNUNET_STATISTICS_update (plugin->env->stats, |
733 | /* Fragmented message: only call next_fragment continuation on success */ | 746 | "# UDP, total, bytes payload, sent", |
747 | udpw->payload_size, GNUNET_NO); | ||
748 | break; | ||
749 | case MSG_FRAGMENTED_COMPLETE: | ||
750 | if (udpw->frag_ctx->cont != NULL) | ||
751 | udpw->frag_ctx->cont (udpw->frag_ctx->cont_cls, &udpw->session->target, GNUNET_OK, | ||
752 | udpw->frag_ctx->payload_size, udpw->frag_ctx->on_wire_size); | ||
753 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
754 | "# UDP, fragmented msgs, messages, sent, success", | ||
755 | 1, GNUNET_NO); | ||
756 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
757 | "# UDP, fragmented msgs, bytes payload, sent, success", | ||
758 | udpw->payload_size, GNUNET_NO); | ||
759 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
760 | "# UDP, fragmented msgs, bytes overhead, sent, success", | ||
761 | overhead, GNUNET_NO); | ||
762 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
763 | "# UDP, total, bytes overhead, sent", | ||
764 | overhead, GNUNET_NO); | ||
765 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
766 | "# UDP, total, bytes payload, sent", | ||
767 | udpw->payload_size, GNUNET_NO); | ||
768 | break; | ||
769 | case MSG_FRAGMENTED: | ||
770 | /* Fragmented message: enqueue next fragment */ | ||
734 | if (NULL != udpw->cont) | 771 | if (NULL != udpw->cont) |
735 | udpw->cont (udpw->cont_cls, &udpw->session->target, result, | 772 | udpw->cont (udpw->cont_cls, &udpw->session->target, result, |
736 | udpw->payload_size, udpw->msg_size); | 773 | udpw->payload_size, udpw->msg_size); |
774 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
775 | "# UDP, fragmented msgs, fragments, sent, success", | ||
776 | 1, GNUNET_NO); | ||
777 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
778 | "# UDP, fragmented msgs, fragments bytes, sent, success", | ||
779 | udpw->msg_size, GNUNET_NO); | ||
780 | break; | ||
781 | case MSG_ACK: | ||
782 | /* No continuation */ | ||
783 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
784 | "# UDP, ACK msgs, messages, sent, success", | ||
785 | 1, GNUNET_NO); | ||
786 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
787 | "# UDP, ACK msgs, bytes overhead, sent, success", | ||
788 | overhead, GNUNET_NO); | ||
789 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
790 | "# UDP, total, bytes overhead, sent", | ||
791 | overhead, GNUNET_NO); | ||
792 | break; | ||
793 | case MSG_BEACON: | ||
794 | GNUNET_break (0); | ||
795 | break; | ||
796 | default: | ||
797 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
798 | "ERROR: %u\n", udpw->msg_type); | ||
799 | GNUNET_break (0); | ||
800 | break; | ||
801 | } | ||
802 | break; | ||
803 | case GNUNET_SYSERR: | ||
804 | switch (udpw->msg_type) { | ||
805 | case MSG_UNFRAGMENTED: | ||
806 | /* Unfragmented message: failed to send */ | ||
807 | if (NULL != udpw->cont) | ||
808 | udpw->cont (udpw->cont_cls, &udpw->session->target, result, | ||
809 | udpw->payload_size, overhead); | ||
810 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
811 | "# UDP, unfragmented msgs, messages, sent, failure", | ||
812 | 1, GNUNET_NO); | ||
813 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
814 | "# UDP, unfragmented msgs, bytes payload, sent, failure", | ||
815 | udpw->payload_size, GNUNET_NO); | ||
816 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
817 | "# UDP, unfragmented msgs, bytes overhead, sent, failure", | ||
818 | overhead, GNUNET_NO); | ||
819 | break; | ||
820 | case MSG_FRAGMENTED_COMPLETE: | ||
821 | if (udpw->frag_ctx->cont != NULL) | ||
822 | udpw->frag_ctx->cont (udpw->frag_ctx->cont_cls, &udpw->session->target, GNUNET_OK, | ||
823 | udpw->frag_ctx->payload_size, udpw->frag_ctx->on_wire_size); | ||
824 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
825 | "# UDP, fragmented msgs, messages, sent, failure", | ||
826 | 1, GNUNET_NO); | ||
827 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
828 | "# UDP, fragmented msgs, bytes payload, sent, failure", | ||
829 | udpw->payload_size, GNUNET_NO); | ||
830 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
831 | "# UDP, fragmented msgs, bytes payload, sent, failure", | ||
832 | overhead, GNUNET_NO); | ||
833 | break; | ||
834 | case MSG_FRAGMENTED: | ||
835 | /* Fragmented message: failed to send */ | ||
836 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
837 | "# UDP, fragmented msgs, fragments, sent, failure", | ||
838 | 1, GNUNET_NO); | ||
839 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
840 | "# UDP, fragmented msgs, fragments bytes, sent, failure", | ||
841 | udpw->msg_size, GNUNET_NO); | ||
842 | break; | ||
843 | case MSG_ACK: | ||
844 | /* ACK message: failed to send */ | ||
845 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
846 | "# UDP, ACK msgs, messages, sent, failure", | ||
847 | 1, GNUNET_NO); | ||
848 | break; | ||
849 | case MSG_BEACON: | ||
850 | /* Beacon message: failed to send */ | ||
851 | GNUNET_break (0); | ||
852 | break; | ||
853 | default: | ||
854 | GNUNET_break (0); | ||
855 | break; | ||
737 | } | 856 | } |
857 | break; | ||
858 | default: | ||
859 | GNUNET_break (0); | ||
860 | break; | ||
738 | } | 861 | } |
739 | } | 862 | } |
740 | 863 | ||
@@ -837,10 +960,10 @@ static void | |||
837 | dequeue (struct Plugin *plugin, struct UDP_MessageWrapper * udpw) | 960 | dequeue (struct Plugin *plugin, struct UDP_MessageWrapper * udpw) |
838 | { | 961 | { |
839 | GNUNET_STATISTICS_update (plugin->env->stats, | 962 | GNUNET_STATISTICS_update (plugin->env->stats, |
840 | "# bytes currently in UDP buffers", | 963 | "# UDP, total, bytes in buffers", |
841 | -udpw->msg_size, GNUNET_NO); | 964 | -udpw->msg_size, GNUNET_NO); |
842 | GNUNET_STATISTICS_update (plugin->env->stats, | 965 | GNUNET_STATISTICS_update (plugin->env->stats, |
843 | "# msgs currently in UDP buffers", | 966 | "# UDP, total, msgs in buffers", |
844 | -1, GNUNET_NO); | 967 | -1, GNUNET_NO); |
845 | if (udpw->session->addrlen == sizeof (struct sockaddr_in)) | 968 | if (udpw->session->addrlen == sizeof (struct sockaddr_in)) |
846 | GNUNET_CONTAINER_DLL_remove (plugin->ipv4_queue_head, | 969 | GNUNET_CONTAINER_DLL_remove (plugin->ipv4_queue_head, |
@@ -912,7 +1035,7 @@ disconnect_session (struct Session *s) | |||
912 | &s->target.hashPubKey, | 1035 | &s->target.hashPubKey, |
913 | s)); | 1036 | s)); |
914 | GNUNET_STATISTICS_set(plugin->env->stats, | 1037 | GNUNET_STATISTICS_set(plugin->env->stats, |
915 | "# UDP sessions active", | 1038 | "# UDP, sessions active", |
916 | GNUNET_CONTAINER_multihashmap_size(plugin->sessions), | 1039 | GNUNET_CONTAINER_multihashmap_size(plugin->sessions), |
917 | GNUNET_NO); | 1040 | GNUNET_NO); |
918 | if (s->rc > 0) | 1041 | if (s->rc > 0) |
@@ -1220,7 +1343,7 @@ udp_plugin_get_session (void *cls, | |||
1220 | s, | 1343 | s, |
1221 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); | 1344 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); |
1222 | GNUNET_STATISTICS_set(plugin->env->stats, | 1345 | GNUNET_STATISTICS_set(plugin->env->stats, |
1223 | "# UDP sessions active", | 1346 | "# UDP, sessions active", |
1224 | GNUNET_CONTAINER_multihashmap_size(plugin->sessions), | 1347 | GNUNET_CONTAINER_multihashmap_size(plugin->sessions), |
1225 | GNUNET_NO); | 1348 | GNUNET_NO); |
1226 | return s; | 1349 | return s; |
@@ -1231,10 +1354,10 @@ static void | |||
1231 | enqueue (struct Plugin *plugin, struct UDP_MessageWrapper * udpw) | 1354 | enqueue (struct Plugin *plugin, struct UDP_MessageWrapper * udpw) |
1232 | { | 1355 | { |
1233 | GNUNET_STATISTICS_update (plugin->env->stats, | 1356 | GNUNET_STATISTICS_update (plugin->env->stats, |
1234 | "# bytes currently in UDP buffers", | 1357 | "# UDP, total, bytes in buffers", |
1235 | udpw->msg_size, GNUNET_NO); | 1358 | udpw->msg_size, GNUNET_NO); |
1236 | GNUNET_STATISTICS_update (plugin->env->stats, | 1359 | GNUNET_STATISTICS_update (plugin->env->stats, |
1237 | "# msgs currently in UDP buffers", | 1360 | "# UDP, total, msgs in buffers", |
1238 | 1, GNUNET_NO); | 1361 | 1, GNUNET_NO); |
1239 | if (udpw->session->addrlen == sizeof (struct sockaddr_in)) | 1362 | if (udpw->session->addrlen == sizeof (struct sockaddr_in)) |
1240 | GNUNET_CONTAINER_DLL_insert (plugin->ipv4_queue_head, | 1363 | GNUNET_CONTAINER_DLL_insert (plugin->ipv4_queue_head, |
@@ -1294,6 +1417,7 @@ enqueue_fragment (void *cls, const struct GNUNET_MessageHeader *msg) | |||
1294 | udpw->cont_cls = udpw; | 1417 | udpw->cont_cls = udpw; |
1295 | udpw->timeout = frag_ctx->timeout; | 1418 | udpw->timeout = frag_ctx->timeout; |
1296 | udpw->frag_ctx = frag_ctx; | 1419 | udpw->frag_ctx = frag_ctx; |
1420 | udpw->msg_type = MSG_FRAGMENTED; | ||
1297 | memcpy (udpw->msg_buf, msg, msg_len); | 1421 | memcpy (udpw->msg_buf, msg, msg_len); |
1298 | enqueue (plugin, udpw); | 1422 | enqueue (plugin, udpw); |
1299 | schedule_select (plugin); | 1423 | schedule_select (plugin); |
@@ -1363,10 +1487,7 @@ udp_plugin_send (void *cls, | |||
1363 | udpmlen, | 1487 | udpmlen, |
1364 | GNUNET_i2s (&s->target), | 1488 | GNUNET_i2s (&s->target), |
1365 | GNUNET_a2s(s->sock_addr, s->addrlen)); | 1489 | GNUNET_a2s(s->sock_addr, s->addrlen)); |
1366 | 1490 | ||
1367 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1368 | "# bytes payload asked to transmit via UDP", | ||
1369 | msgbuf_size, GNUNET_NO); | ||
1370 | 1491 | ||
1371 | /* Message */ | 1492 | /* Message */ |
1372 | udp = (struct UDPMessage *) mbuf; | 1493 | udp = (struct UDPMessage *) mbuf; |
@@ -1379,9 +1500,6 @@ udp_plugin_send (void *cls, | |||
1379 | if (udpmlen <= UDP_MTU) | 1500 | if (udpmlen <= UDP_MTU) |
1380 | { | 1501 | { |
1381 | /* unfragmented message */ | 1502 | /* unfragmented message */ |
1382 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1383 | "# unfragmented messages asked to transmit via UDP", | ||
1384 | 1, GNUNET_NO); | ||
1385 | udpw = GNUNET_malloc (sizeof (struct UDP_MessageWrapper) + udpmlen); | 1503 | udpw = GNUNET_malloc (sizeof (struct UDP_MessageWrapper) + udpmlen); |
1386 | udpw->session = s; | 1504 | udpw->session = s; |
1387 | udpw->msg_buf = (char *) &udpw[1]; | 1505 | udpw->msg_buf = (char *) &udpw[1]; |
@@ -1391,16 +1509,21 @@ udp_plugin_send (void *cls, | |||
1391 | udpw->cont = cont; | 1509 | udpw->cont = cont; |
1392 | udpw->cont_cls = cont_cls; | 1510 | udpw->cont_cls = cont_cls; |
1393 | udpw->frag_ctx = NULL; | 1511 | udpw->frag_ctx = NULL; |
1512 | udpw->msg_type = MSG_UNFRAGMENTED; | ||
1394 | memcpy (udpw->msg_buf, udp, sizeof (struct UDPMessage)); | 1513 | memcpy (udpw->msg_buf, udp, sizeof (struct UDPMessage)); |
1395 | memcpy (&udpw->msg_buf[sizeof (struct UDPMessage)], msgbuf, msgbuf_size); | 1514 | memcpy (&udpw->msg_buf[sizeof (struct UDPMessage)], msgbuf, msgbuf_size); |
1396 | enqueue (plugin, udpw); | 1515 | enqueue (plugin, udpw); |
1516 | |||
1517 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1518 | "# UDP, unfragmented msgs, messages, attempt", | ||
1519 | 1, GNUNET_NO); | ||
1520 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1521 | "# UDP, unfragmented msgs, bytes payload, attempt", | ||
1522 | udpw->payload_size, GNUNET_NO); | ||
1397 | } | 1523 | } |
1398 | else | 1524 | else |
1399 | { | 1525 | { |
1400 | /* fragmented message */ | 1526 | /* fragmented message */ |
1401 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1402 | "# fragmented messages asked to transmit via UDP", | ||
1403 | 1, GNUNET_NO); | ||
1404 | if (s->frag_ctx != NULL) | 1527 | if (s->frag_ctx != NULL) |
1405 | return GNUNET_SYSERR; | 1528 | return GNUNET_SYSERR; |
1406 | memcpy (&udp[1], msgbuf, msgbuf_size); | 1529 | memcpy (&udp[1], msgbuf, msgbuf_size); |
@@ -1420,6 +1543,13 @@ udp_plugin_send (void *cls, | |||
1420 | &enqueue_fragment, | 1543 | &enqueue_fragment, |
1421 | frag_ctx); | 1544 | frag_ctx); |
1422 | s->frag_ctx = frag_ctx; | 1545 | s->frag_ctx = frag_ctx; |
1546 | |||
1547 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1548 | "# UDP, fragmented msgs, messages, attempt", | ||
1549 | 1, GNUNET_NO); | ||
1550 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1551 | "# UDP, fragmented msgs, bytes payload, attempt", | ||
1552 | frag_ctx->payload_size, GNUNET_NO); | ||
1423 | } | 1553 | } |
1424 | schedule_select (plugin); | 1554 | schedule_select (plugin); |
1425 | return udpmlen; | 1555 | return udpmlen; |
@@ -1712,17 +1842,13 @@ ack_proc (void *cls, uint32_t id, const struct GNUNET_MessageHeader *msg) | |||
1712 | udpw->session = s; | 1842 | udpw->session = s; |
1713 | udpw->timeout = GNUNET_TIME_UNIT_FOREVER_ABS; | 1843 | udpw->timeout = GNUNET_TIME_UNIT_FOREVER_ABS; |
1714 | udpw->msg_buf = (char *)&udpw[1]; | 1844 | udpw->msg_buf = (char *)&udpw[1]; |
1845 | udpw->msg_type = MSG_ACK; | ||
1715 | udp_ack = (struct UDP_ACK_Message *) udpw->msg_buf; | 1846 | udp_ack = (struct UDP_ACK_Message *) udpw->msg_buf; |
1716 | udp_ack->header.size = htons ((uint16_t) msize); | 1847 | udp_ack->header.size = htons ((uint16_t) msize); |
1717 | udp_ack->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_ACK); | 1848 | udp_ack->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_ACK); |
1718 | udp_ack->delay = htonl (delay); | 1849 | udp_ack->delay = htonl (delay); |
1719 | udp_ack->sender = *rc->plugin->env->my_identity; | 1850 | udp_ack->sender = *rc->plugin->env->my_identity; |
1720 | memcpy (&udp_ack[1], msg, ntohs (msg->size)); | 1851 | memcpy (&udp_ack[1], msg, ntohs (msg->size)); |
1721 | |||
1722 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1723 | "# messages ACKs transmitted via UDP", | ||
1724 | 1, GNUNET_NO); | ||
1725 | |||
1726 | enqueue (rc->plugin, udpw); | 1852 | enqueue (rc->plugin, udpw); |
1727 | } | 1853 | } |
1728 | 1854 | ||
@@ -1749,6 +1875,9 @@ read_process_ack (struct Plugin *plugin, | |||
1749 | char *addr, | 1875 | char *addr, |
1750 | socklen_t fromlen) | 1876 | socklen_t fromlen) |
1751 | { | 1877 | { |
1878 | struct UDP_MessageWrapper dummy; | ||
1879 | struct UDP_MessageWrapper * udpw; | ||
1880 | struct UDP_MessageWrapper * tmp; | ||
1752 | const struct GNUNET_MessageHeader *ack; | 1881 | const struct GNUNET_MessageHeader *ack; |
1753 | const struct UDP_ACK_Message *udp_ack; | 1882 | const struct UDP_ACK_Message *udp_ack; |
1754 | struct LookupContext l_ctx; | 1883 | struct LookupContext l_ctx; |
@@ -1787,6 +1916,9 @@ read_process_ack (struct Plugin *plugin, | |||
1787 | return; | 1916 | return; |
1788 | } | 1917 | } |
1789 | 1918 | ||
1919 | if (0 != memcmp (&l_ctx.res->target, &udp_ack->sender, sizeof (struct GNUNET_PeerIdentity))) | ||
1920 | GNUNET_break (0); | ||
1921 | |||
1790 | if (GNUNET_OK != GNUNET_FRAGMENT_process_ack (s->frag_ctx->frag, ack)) | 1922 | if (GNUNET_OK != GNUNET_FRAGMENT_process_ack (s->frag_ctx->frag, ack)) |
1791 | { | 1923 | { |
1792 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1924 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1803,8 +1935,6 @@ read_process_ack (struct Plugin *plugin, | |||
1803 | GNUNET_a2s ((const struct sockaddr *) addr, fromlen)); | 1935 | GNUNET_a2s ((const struct sockaddr *) addr, fromlen)); |
1804 | s->last_expected_delay = GNUNET_FRAGMENT_context_destroy (s->frag_ctx->frag); | 1936 | s->last_expected_delay = GNUNET_FRAGMENT_context_destroy (s->frag_ctx->frag); |
1805 | 1937 | ||
1806 | struct UDP_MessageWrapper * udpw; | ||
1807 | struct UDP_MessageWrapper * tmp; | ||
1808 | if (s->addrlen == sizeof (struct sockaddr_in6)) | 1938 | if (s->addrlen == sizeof (struct sockaddr_in6)) |
1809 | { | 1939 | { |
1810 | udpw = plugin->ipv6_queue_head; | 1940 | udpw = plugin->ipv6_queue_head; |
@@ -1834,30 +1964,14 @@ read_process_ack (struct Plugin *plugin, | |||
1834 | } | 1964 | } |
1835 | } | 1965 | } |
1836 | 1966 | ||
1837 | GNUNET_STATISTICS_update (plugin->env->stats, | 1967 | dummy.msg_type = MSG_FRAGMENTED_COMPLETE; |
1838 | "# bytes payload transmitted via UDP", | 1968 | dummy.msg_buf = NULL; |
1839 | s->frag_ctx->payload_size, GNUNET_NO); | 1969 | dummy.msg_size = s->frag_ctx->on_wire_size; |
1840 | 1970 | dummy.payload_size = s->frag_ctx->payload_size; | |
1841 | GNUNET_STATISTICS_update (plugin->env->stats, | 1971 | dummy.frag_ctx = s->frag_ctx; |
1842 | "# fragmented messages transmit with success via UDP", | 1972 | dummy.session = s; |
1843 | 1, GNUNET_NO); | ||
1844 | |||
1845 | if (s->frag_ctx->on_wire_size >= s->frag_ctx->payload_size) | ||
1846 | { | ||
1847 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1848 | "# bytes overhead transmitted via UDP", | ||
1849 | s->frag_ctx->on_wire_size - s->frag_ctx->payload_size, GNUNET_NO); | ||
1850 | } | ||
1851 | |||
1852 | if (s->frag_ctx->cont != NULL) | ||
1853 | { | ||
1854 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1855 | "Calling continuation for fragmented message to `%s' with result %s\n", | ||
1856 | GNUNET_i2s (&s->target), "OK"); | ||
1857 | 1973 | ||
1858 | s->frag_ctx->cont (s->frag_ctx->cont_cls, &udp_ack->sender, GNUNET_OK, | 1974 | call_continuation (&dummy, GNUNET_OK); |
1859 | s->frag_ctx->payload_size, s->frag_ctx->on_wire_size); | ||
1860 | } | ||
1861 | 1975 | ||
1862 | GNUNET_free (s->frag_ctx); | 1976 | GNUNET_free (s->frag_ctx); |
1863 | s->frag_ctx = NULL; | 1977 | s->frag_ctx = NULL; |
@@ -1981,7 +2095,7 @@ udp_select_read (struct Plugin *plugin, struct GNUNET_NETWORK_Handle *rsock) | |||
1981 | } | 2095 | } |
1982 | 2096 | ||
1983 | GNUNET_STATISTICS_update (plugin->env->stats, | 2097 | GNUNET_STATISTICS_update (plugin->env->stats, |
1984 | "# bytes received via UDP", | 2098 | "# UDP, total, bytes, received", |
1985 | size, GNUNET_NO); | 2099 | size, GNUNET_NO); |
1986 | 2100 | ||
1987 | switch (ntohs (msg->type)) | 2101 | switch (ntohs (msg->type)) |
@@ -2158,6 +2272,12 @@ udp_select_send (struct Plugin *plugin, struct GNUNET_NETWORK_Handle *sock) | |||
2158 | /* Failure */ | 2272 | /* Failure */ |
2159 | analyze_send_error (plugin, sa, slen, errno); | 2273 | analyze_send_error (plugin, sa, slen, errno); |
2160 | call_continuation(udpw, GNUNET_SYSERR); | 2274 | call_continuation(udpw, GNUNET_SYSERR); |
2275 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
2276 | "# UDP, total, bytes, sent, failure", | ||
2277 | sent, GNUNET_NO); | ||
2278 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
2279 | "# UDP, total, messages, sent, failure", | ||
2280 | 1, GNUNET_NO); | ||
2161 | } | 2281 | } |
2162 | else | 2282 | else |
2163 | { | 2283 | { |
@@ -2167,8 +2287,11 @@ udp_select_send (struct Plugin *plugin, struct GNUNET_NETWORK_Handle *sock) | |||
2167 | (unsigned int) (udpw->msg_size), GNUNET_i2s(&udpw->session->target) ,GNUNET_a2s (sa, slen), (int) sent, | 2287 | (unsigned int) (udpw->msg_size), GNUNET_i2s(&udpw->session->target) ,GNUNET_a2s (sa, slen), (int) sent, |
2168 | (sent < 0) ? STRERROR (errno) : "ok"); | 2288 | (sent < 0) ? STRERROR (errno) : "ok"); |
2169 | GNUNET_STATISTICS_update (plugin->env->stats, | 2289 | GNUNET_STATISTICS_update (plugin->env->stats, |
2170 | "# bytes transmitted via UDP", | 2290 | "# UDP, total, bytes, sent, success", |
2171 | sent, GNUNET_NO); | 2291 | sent, GNUNET_NO); |
2292 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
2293 | "# UDP, total, messages, sent, success", | ||
2294 | 1, GNUNET_NO); | ||
2172 | if (NULL != udpw->frag_ctx) | 2295 | if (NULL != udpw->frag_ctx) |
2173 | udpw->frag_ctx->on_wire_size += udpw->msg_size; | 2296 | udpw->frag_ctx->on_wire_size += udpw->msg_size; |
2174 | call_continuation (udpw, GNUNET_OK); | 2297 | call_continuation (udpw, GNUNET_OK); |