aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-10-16 11:20:27 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-10-16 11:20:27 +0000
commit77990e170e992a745b7edde92fbb705247ab83e8 (patch)
tree5e686547c9bb6d8a752a00c08616a79e872cb8db /src/transport
parent15f8a6f2e023e9da4b41153ecb3fafda2e23cfe7 (diff)
downloadgnunet-77990e170e992a745b7edde92fbb705247ab83e8.tar.gz
gnunet-77990e170e992a745b7edde92fbb705247ab83e8.zip
overhead reporting
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-service-transport_clients.c5
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c17
-rw-r--r--src/transport/gnunet-service-transport_neighbours.h4
-rw-r--r--src/transport/plugin_transport_http_client.c15
-rw-r--r--src/transport/plugin_transport_http_server.c11
-rw-r--r--src/transport/plugin_transport_tcp.c8
-rw-r--r--src/transport/plugin_transport_udp.c28
-rw-r--r--src/transport/plugin_transport_unix.c14
-rw-r--r--src/transport/plugin_transport_wlan.c20
9 files changed, 88 insertions, 34 deletions
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index 1beb39ff6..065e8c4e6 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -562,11 +562,14 @@ struct SendTransmitContinuationContext
562 * @param success GNUNET_OK on success, GNUNET_NO on failure, GNUNET_SYSERR if we're not connected 562 * @param success GNUNET_OK on success, GNUNET_NO on failure, GNUNET_SYSERR if we're not connected
563 */ 563 */
564static void 564static void
565handle_send_transmit_continuation (void *cls, int success) 565handle_send_transmit_continuation (void *cls, int success,
566 size_t bytes_payload, size_t bytes_on_wire)
566{ 567{
567 struct SendTransmitContinuationContext *stcc = cls; 568 struct SendTransmitContinuationContext *stcc = cls;
568 struct SendOkMessage send_ok_msg; 569 struct SendOkMessage send_ok_msg;
569 570
571 //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Payload: %u, On wire %u \n", bytes_payload, bytes_on_wire);
572
570 send_ok_msg.header.size = htons (sizeof (send_ok_msg)); 573 send_ok_msg.header.size = htons (sizeof (send_ok_msg));
571 send_ok_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK); 574 send_ok_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK);
572 send_ok_msg.success = htonl (success); 575 send_ok_msg.success = htonl (success);
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index da42b8c56..00ce6e5a0 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -862,7 +862,7 @@ free_neighbour (struct NeighbourMapEntry *n, int keep_sessions)
862 { 862 {
863 GNUNET_CONTAINER_DLL_remove (n->messages_head, n->messages_tail, mq); 863 GNUNET_CONTAINER_DLL_remove (n->messages_head, n->messages_tail, mq);
864 if (NULL != mq->cont) 864 if (NULL != mq->cont)
865 mq->cont (mq->cont_cls, GNUNET_SYSERR); 865 mq->cont (mq->cont_cls, GNUNET_SYSERR, mq->message_buf_size, 0);
866 GNUNET_free (mq); 866 GNUNET_free (mq);
867 } 867 }
868 /* It is too late to send other peer disconnect notifications, but at 868 /* It is too late to send other peer disconnect notifications, but at
@@ -955,7 +955,7 @@ send_with_session (struct NeighbourMapEntry *n,
955 timeout, 955 timeout,
956 cont, cont_cls)))) && 956 cont, cont_cls)))) &&
957 (NULL != cont)) 957 (NULL != cont))
958 cont (cont_cls, &n->id, GNUNET_SYSERR); 958 cont (cont_cls, &n->id, GNUNET_SYSERR, msgbuf_size, 0);
959 GNUNET_break (NULL != papi); 959 GNUNET_break (NULL != papi);
960} 960}
961 961
@@ -983,7 +983,7 @@ master_task (void *cls,
983 */ 983 */
984static void 984static void
985send_disconnect_cont (void *cls, const struct GNUNET_PeerIdentity *target, 985send_disconnect_cont (void *cls, const struct GNUNET_PeerIdentity *target,
986 int result) 986 int result, size_t payload, size_t physical)
987{ 987{
988 struct NeighbourMapEntry *n; 988 struct NeighbourMapEntry *n;
989 989
@@ -1130,7 +1130,7 @@ disconnect_neighbour (struct NeighbourMapEntry *n)
1130static void 1130static void
1131transmit_send_continuation (void *cls, 1131transmit_send_continuation (void *cls,
1132 const struct GNUNET_PeerIdentity *receiver, 1132 const struct GNUNET_PeerIdentity *receiver,
1133 int success) 1133 int success, size_t size_payload, size_t physical)
1134{ 1134{
1135 struct MessageQueue *mq = cls; 1135 struct MessageQueue *mq = cls;
1136 struct NeighbourMapEntry *n; 1136 struct NeighbourMapEntry *n;
@@ -1150,6 +1150,7 @@ transmit_send_continuation (void *cls,
1150 n->task = GNUNET_SCHEDULER_add_now (&master_task, n); 1150 n->task = GNUNET_SCHEDULER_add_now (&master_task, n);
1151 } 1151 }
1152 GNUNET_assert (bytes_in_send_queue >= mq->message_buf_size); 1152 GNUNET_assert (bytes_in_send_queue >= mq->message_buf_size);
1153 GNUNET_break (size_payload == mq->message_buf_size);
1153 bytes_in_send_queue -= mq->message_buf_size; 1154 bytes_in_send_queue -= mq->message_buf_size;
1154 GNUNET_STATISTICS_set (GST_stats, 1155 GNUNET_STATISTICS_set (GST_stats,
1155 gettext_noop 1156 gettext_noop
@@ -1171,7 +1172,7 @@ transmit_send_continuation (void *cls,
1171 ntohs (((struct GNUNET_MessageHeader *) mq->message_buf)->type), 1172 ntohs (((struct GNUNET_MessageHeader *) mq->message_buf)->type),
1172 (success == GNUNET_OK) ? "success" : "FAILURE"); 1173 (success == GNUNET_OK) ? "success" : "FAILURE");
1173 if (NULL != mq->cont) 1174 if (NULL != mq->cont)
1174 mq->cont (mq->cont_cls, success); 1175 mq->cont (mq->cont_cls, success, size_payload, physical);
1175 GNUNET_free (mq); 1176 GNUNET_free (mq);
1176} 1177}
1177 1178
@@ -1224,7 +1225,7 @@ try_transmission_to_peer (struct NeighbourMapEntry *n)
1224 1, GNUNET_NO); 1225 1, GNUNET_NO);
1225 GNUNET_CONTAINER_DLL_remove (n->messages_head, n->messages_tail, mq); 1226 GNUNET_CONTAINER_DLL_remove (n->messages_head, n->messages_tail, mq);
1226 n->is_active = mq; 1227 n->is_active = mq;
1227 transmit_send_continuation (mq, &n->id, GNUNET_SYSERR); /* timeout */ 1228 transmit_send_continuation (mq, &n->id, GNUNET_SYSERR, mq->message_buf_size, 0); /* timeout */
1228 } 1229 }
1229 if (NULL == mq) 1230 if (NULL == mq)
1230 return; /* no more messages */ 1231 return; /* no more messages */
@@ -1477,14 +1478,14 @@ GST_neighbours_send (const struct GNUNET_PeerIdentity *target, const void *msg,
1477 { 1478 {
1478 GNUNET_break (0); 1479 GNUNET_break (0);
1479 if (NULL != cont) 1480 if (NULL != cont)
1480 cont (cont_cls, GNUNET_SYSERR); 1481 cont (cont_cls, GNUNET_SYSERR, msg_size, 0);
1481 return; 1482 return;
1482 } 1483 }
1483 if (GNUNET_YES != test_connected (n)) 1484 if (GNUNET_YES != test_connected (n))
1484 { 1485 {
1485 GNUNET_break (0); 1486 GNUNET_break (0);
1486 if (NULL != cont) 1487 if (NULL != cont)
1487 cont (cont_cls, GNUNET_SYSERR); 1488 cont (cont_cls, GNUNET_SYSERR, msg_size, 0);
1488 return; 1489 return;
1489 } 1490 }
1490 bytes_in_send_queue += msg_size; 1491 bytes_in_send_queue += msg_size;
diff --git a/src/transport/gnunet-service-transport_neighbours.h b/src/transport/gnunet-service-transport_neighbours.h
index d137c311d..6a743359f 100644
--- a/src/transport/gnunet-service-transport_neighbours.h
+++ b/src/transport/gnunet-service-transport_neighbours.h
@@ -84,7 +84,9 @@ GST_neighbours_test_connected (const struct GNUNET_PeerIdentity *target);
84 * @param cls closure 84 * @param cls closure
85 * @param success GNUNET_OK on success, GNUNET_NO on failure, GNUNET_SYSERR if we're not connected 85 * @param success GNUNET_OK on success, GNUNET_NO on failure, GNUNET_SYSERR if we're not connected
86 */ 86 */
87typedef void (*GST_NeighbourSendContinuation) (void *cls, int success); 87typedef void (*GST_NeighbourSendContinuation) (void *cls, int success,
88 size_t bytes_payload,
89 size_t bytes_on_wire);
88 90
89 91
90/** 92/**
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index 536e7382b..e6f52850f 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -85,6 +85,12 @@ struct HTTP_Message
85 size_t size; 85 size_t size;
86 86
87 /** 87 /**
88 * HTTP overhead required to send this message
89 * FIXME: to implement
90 */
91 size_t overhead;
92
93 /**
88 * Continuation function to call once the transmission buffer 94 * Continuation function to call once the transmission buffer
89 * has again space available. NULL if there is no 95 * has again space available. NULL if there is no
90 * continuation to call. 96 * continuation to call.
@@ -546,7 +552,8 @@ client_delete_session (struct Session *s)
546 next = pos->next; 552 next = pos->next;
547 GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, pos); 553 GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, pos);
548 if (pos->transmit_cont != NULL) 554 if (pos->transmit_cont != NULL)
549 pos->transmit_cont (pos->transmit_cont_cls, &s->target, GNUNET_SYSERR); 555 pos->transmit_cont (pos->transmit_cont_cls, &s->target, GNUNET_SYSERR,
556 pos->size, pos->pos + pos->overhead);
550 GNUNET_free (pos); 557 GNUNET_free (pos);
551 } 558 }
552 559
@@ -631,7 +638,8 @@ client_disconnect (struct Session *s)
631 { 638 {
632 t = msg->next; 639 t = msg->next;
633 if (NULL != msg->transmit_cont) 640 if (NULL != msg->transmit_cont)
634 msg->transmit_cont (msg->transmit_cont_cls, &s->target, GNUNET_SYSERR); 641 msg->transmit_cont (msg->transmit_cont_cls, &s->target, GNUNET_SYSERR,
642 msg->size, msg->pos + msg->overhead);
635 GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, msg); 643 GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, msg);
636 GNUNET_free (msg); 644 GNUNET_free (msg);
637 msg = t; 645 msg = t;
@@ -784,7 +792,8 @@ client_send_cb (void *stream, size_t size, size_t nmemb, void *cls)
784 /* Calling transmit continuation */ 792 /* Calling transmit continuation */
785 GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, msg); 793 GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, msg);
786 if (NULL != msg->transmit_cont) 794 if (NULL != msg->transmit_cont)
787 msg->transmit_cont (msg->transmit_cont_cls, &s->target, GNUNET_OK); 795 msg->transmit_cont (msg->transmit_cont_cls, &s->target, GNUNET_OK,
796 msg->size, msg->size + msg->overhead);
788 GNUNET_free (msg); 797 GNUNET_free (msg);
789 } 798 }
790 799
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index ea4a09175..a8731907e 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -398,6 +398,11 @@ struct HTTP_Message
398 size_t size; 398 size_t size;
399 399
400 /** 400 /**
401 * HTTP/S specific overhead
402 */
403 size_t overhead;
404
405 /**
401 * Continuation function to call once the transmission buffer 406 * Continuation function to call once the transmission buffer
402 * has again space available. NULL if there is no 407 * has again space available. NULL if there is no
403 * continuation to call. 408 * continuation to call.
@@ -680,7 +685,8 @@ server_delete_session (struct Session *s)
680 GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, msg); 685 GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, msg);
681 if (msg->transmit_cont != NULL) 686 if (msg->transmit_cont != NULL)
682 { 687 {
683 msg->transmit_cont (msg->transmit_cont_cls, &s->target, GNUNET_SYSERR); 688 msg->transmit_cont (msg->transmit_cont_cls, &s->target, GNUNET_SYSERR,
689 msg->size, msg->pos + msg->overhead);
684 } 690 }
685 GNUNET_free (msg); 691 GNUNET_free (msg);
686 msg = tmp; 692 msg = tmp;
@@ -1203,7 +1209,8 @@ server_send_callback (void *cls, uint64_t pos, char *buf, size_t max)
1203 { 1209 {
1204 GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, msg); 1210 GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, msg);
1205 if (NULL != msg->transmit_cont) 1211 if (NULL != msg->transmit_cont)
1206 msg->transmit_cont (msg->transmit_cont_cls, &s->target, GNUNET_OK); 1212 msg->transmit_cont (msg->transmit_cont_cls, &s->target, GNUNET_OK,
1213 msg->size, msg->size + msg->overhead);
1207 GNUNET_free (msg); 1214 GNUNET_free (msg);
1208 } 1215 }
1209 } 1216 }
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 877356c16..99da8bb17 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -849,7 +849,7 @@ do_transmit (void *cls, size_t size, void *buf)
849 { 849 {
850 GNUNET_CONTAINER_DLL_remove (hd, tl, pos); 850 GNUNET_CONTAINER_DLL_remove (hd, tl, pos);
851 if (pos->transmit_cont != NULL) 851 if (pos->transmit_cont != NULL)
852 pos->transmit_cont (pos->transmit_cont_cls, &pid, GNUNET_SYSERR); 852 pos->transmit_cont (pos->transmit_cont_cls, &pid, GNUNET_SYSERR, pos->message_size, 0);
853 GNUNET_free (pos); 853 GNUNET_free (pos);
854 } 854 }
855 GNUNET_STATISTICS_update (plugin->env->stats, 855 GNUNET_STATISTICS_update (plugin->env->stats,
@@ -895,7 +895,7 @@ do_transmit (void *cls, size_t size, void *buf)
895 { 895 {
896 GNUNET_CONTAINER_DLL_remove (hd, tl, pos); 896 GNUNET_CONTAINER_DLL_remove (hd, tl, pos);
897 if (pos->transmit_cont != NULL) 897 if (pos->transmit_cont != NULL)
898 pos->transmit_cont (pos->transmit_cont_cls, &pid, GNUNET_OK); 898 pos->transmit_cont (pos->transmit_cont_cls, &pid, GNUNET_OK, pos->message_size, pos->message_size); /* FIXME: include TCP overhead */
899 GNUNET_free (pos); 899 GNUNET_free (pos);
900 } 900 }
901 GNUNET_assert (hd == NULL); 901 GNUNET_assert (hd == NULL);
@@ -999,7 +999,7 @@ disconnect_session (struct Session *session)
999 session->pending_messages_tail, pm); 999 session->pending_messages_tail, pm);
1000 if (NULL != pm->transmit_cont) 1000 if (NULL != pm->transmit_cont)
1001 pm->transmit_cont (pm->transmit_cont_cls, &session->target, 1001 pm->transmit_cont (pm->transmit_cont_cls, &session->target,
1002 GNUNET_SYSERR); 1002 GNUNET_SYSERR, pm->message_size, 0);
1003 GNUNET_free (pm); 1003 GNUNET_free (pm);
1004 } 1004 }
1005 if (session->receive_delay_task != GNUNET_SCHEDULER_NO_TASK) 1005 if (session->receive_delay_task != GNUNET_SCHEDULER_NO_TASK)
@@ -1159,7 +1159,7 @@ tcp_plugin_send (void *cls,
1159 LOG (GNUNET_ERROR_TYPE_ERROR, 1159 LOG (GNUNET_ERROR_TYPE_ERROR,
1160 "Invalid session %p\n", session); 1160 "Invalid session %p\n", session);
1161 if (NULL != cont) 1161 if (NULL != cont)
1162 cont (cont_cls, &session->target, GNUNET_SYSERR); 1162 cont (cont_cls, &session->target, GNUNET_SYSERR, pm->message_size, 0);
1163 GNUNET_break (0); 1163 GNUNET_break (0);
1164 GNUNET_free (pm); 1164 GNUNET_free (pm);
1165 return GNUNET_SYSERR; /* session does not exist here */ 1165 return GNUNET_SYSERR; /* session does not exist here */
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 1630c48b1..c7bfe6237 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -273,6 +273,11 @@ struct UDP_FragmentationContext
273 * Payload size of original unfragmented message 273 * Payload size of original unfragmented message
274 */ 274 */
275 size_t payload_size; 275 size_t payload_size;
276
277 /**
278 * Bytes used to send all fragments on wire including UDP overhead
279 */
280 size_t on_wire_size;
276}; 281};
277 282
278 283
@@ -688,7 +693,12 @@ call_continuation (struct UDP_MessageWrapper *udpw, int result)
688 if (NULL != udpw->cont) 693 if (NULL != udpw->cont)
689 { 694 {
690 /* FIXME: add bytes used on wire here */ 695 /* FIXME: add bytes used on wire here */
691 udpw->cont (udpw->cont_cls, &udpw->session->target, result); 696 /* Calls transport continuation if message was not fragmented,
697 * GNUNET_FRAGMENT if just an fragment was sent
698 */
699
700 /* Call continuation for fragmented message */
701 udpw->cont (udpw->cont_cls, &udpw->session->target, result, udpw->payload_size, udpw->msg_size);
692 } 702 }
693 703
694} 704}
@@ -837,7 +847,8 @@ disconnect_session (struct Session *s)
837 { 847 {
838 if (NULL != s->frag_ctx->cont) 848 if (NULL != s->frag_ctx->cont)
839 { 849 {
840 s->frag_ctx->cont (s->frag_ctx->cont_cls, &s->target, GNUNET_SYSERR); 850 s->frag_ctx->cont (s->frag_ctx->cont_cls, &s->target, GNUNET_SYSERR,
851 s->frag_ctx->payload_size, s->frag_ctx->on_wire_size);
841 LOG (GNUNET_ERROR_TYPE_DEBUG, 852 LOG (GNUNET_ERROR_TYPE_DEBUG,
842 "Calling continuation for fragemented message to `%s' with result SYSERR\n", 853 "Calling continuation for fragemented message to `%s' with result SYSERR\n",
843 GNUNET_i2s (&s->target)); 854 GNUNET_i2s (&s->target));
@@ -1186,10 +1197,9 @@ enqueue (struct Plugin *plugin, struct UDP_MessageWrapper * udpw)
1186static void 1197static void
1187send_next_fragment (void *cls, 1198send_next_fragment (void *cls,
1188 const struct GNUNET_PeerIdentity *target, 1199 const struct GNUNET_PeerIdentity *target,
1189 int result) 1200 int result, size_t payload, size_t physical)
1190{ 1201{
1191 struct UDP_MessageWrapper *udpw = cls; 1202 struct UDP_MessageWrapper *udpw = cls;
1192
1193 GNUNET_FRAGMENT_context_transmission_done (udpw->frag_ctx->frag); 1203 GNUNET_FRAGMENT_context_transmission_done (udpw->frag_ctx->frag);
1194} 1204}
1195 1205
@@ -1223,6 +1233,7 @@ enqueue_fragment (void *cls, const struct GNUNET_MessageHeader *msg)
1223 udpw->timeout = frag_ctx->timeout; 1233 udpw->timeout = frag_ctx->timeout;
1224 udpw->frag_ctx = frag_ctx; 1234 udpw->frag_ctx = frag_ctx;
1225 memcpy (udpw->msg_buf, msg, msg_len); 1235 memcpy (udpw->msg_buf, msg, msg_len);
1236 frag_ctx->on_wire_size += msg_len;
1226 enqueue (plugin, udpw); 1237 enqueue (plugin, udpw);
1227 schedule_select (plugin); 1238 schedule_select (plugin);
1228} 1239}
@@ -1337,6 +1348,7 @@ udp_plugin_send (void *cls,
1337 frag_ctx->cont_cls = cont_cls; 1348 frag_ctx->cont_cls = cont_cls;
1338 frag_ctx->timeout = GNUNET_TIME_absolute_add(GNUNET_TIME_absolute_get(), to); 1349 frag_ctx->timeout = GNUNET_TIME_absolute_add(GNUNET_TIME_absolute_get(), to);
1339 frag_ctx->payload_size = msgbuf_size; /* unfragmented message size without UDP overhead */ 1350 frag_ctx->payload_size = msgbuf_size; /* unfragmented message size without UDP overhead */
1351 frag_ctx->on_wire_size = 0;
1340 frag_ctx->frag = GNUNET_FRAGMENT_context_create (plugin->env->stats, 1352 frag_ctx->frag = GNUNET_FRAGMENT_context_create (plugin->env->stats,
1341 UDP_MTU, 1353 UDP_MTU,
1342 &plugin->tracker, 1354 &plugin->tracker,
@@ -1344,7 +1356,6 @@ udp_plugin_send (void *cls,
1344 &udp->header, 1356 &udp->header,
1345 &enqueue_fragment, 1357 &enqueue_fragment,
1346 frag_ctx); 1358 frag_ctx);
1347
1348 s->frag_ctx = frag_ctx; 1359 s->frag_ctx = frag_ctx;
1349 } 1360 }
1350 schedule_select (plugin); 1361 schedule_select (plugin);
@@ -1714,11 +1725,12 @@ read_process_ack (struct Plugin *plugin,
1714 "UDP processes %u-byte acknowledgement from `%s' at `%s'\n", 1725 "UDP processes %u-byte acknowledgement from `%s' at `%s'\n",
1715 (unsigned int) ntohs (msg->size), GNUNET_i2s (&udp_ack->sender), 1726 (unsigned int) ntohs (msg->size), GNUNET_i2s (&udp_ack->sender),
1716 GNUNET_a2s ((const struct sockaddr *) addr, fromlen)); 1727 GNUNET_a2s ((const struct sockaddr *) addr, fromlen));
1728 /* Expect more ACKs to arrive */
1717 return; 1729 return;
1718 } 1730 }
1719 1731
1720 LOG (GNUNET_ERROR_TYPE_DEBUG, 1732 LOG (GNUNET_ERROR_TYPE_DEBUG,
1721 "FULL MESSAGE ACKed\n", 1733 "Message full ACK'ed\n",
1722 (unsigned int) ntohs (msg->size), GNUNET_i2s (&udp_ack->sender), 1734 (unsigned int) ntohs (msg->size), GNUNET_i2s (&udp_ack->sender),
1723 GNUNET_a2s ((const struct sockaddr *) addr, fromlen)); 1735 GNUNET_a2s ((const struct sockaddr *) addr, fromlen));
1724 s->last_expected_delay = GNUNET_FRAGMENT_context_destroy (s->frag_ctx->frag); 1736 s->last_expected_delay = GNUNET_FRAGMENT_context_destroy (s->frag_ctx->frag);
@@ -1759,7 +1771,9 @@ read_process_ack (struct Plugin *plugin,
1759 LOG (GNUNET_ERROR_TYPE_DEBUG, 1771 LOG (GNUNET_ERROR_TYPE_DEBUG,
1760 "Calling continuation for fragmented message to `%s' with result %s\n", 1772 "Calling continuation for fragmented message to `%s' with result %s\n",
1761 GNUNET_i2s (&s->target), "OK"); 1773 GNUNET_i2s (&s->target), "OK");
1762 s->frag_ctx->cont (s->frag_ctx->cont_cls, &udp_ack->sender, GNUNET_OK); 1774 /* FIXME add overhead bytes here */
1775 s->frag_ctx->cont (s->frag_ctx->cont_cls, &udp_ack->sender, GNUNET_OK,
1776 s->frag_ctx->payload_size, s->frag_ctx->on_wire_size);
1763 } 1777 }
1764 1778
1765 GNUNET_free (s->frag_ctx); 1779 GNUNET_free (s->frag_ctx);
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c
index fc1556591..5fda1191a 100644
--- a/src/transport/plugin_transport_unix.c
+++ b/src/transport/plugin_transport_unix.c
@@ -377,7 +377,8 @@ disconnect_session (struct Session *s)
377 continue; 377 continue;
378 GNUNET_CONTAINER_DLL_remove (plugin->msg_head, plugin->msg_tail, msgw); 378 GNUNET_CONTAINER_DLL_remove (plugin->msg_head, plugin->msg_tail, msgw);
379 if (NULL != msgw->cont) 379 if (NULL != msgw->cont)
380 msgw->cont (msgw->cont_cls, &msgw->session->target, GNUNET_SYSERR); 380 msgw->cont (msgw->cont_cls, &msgw->session->target, GNUNET_SYSERR,
381 msgw->msgsize, 0);
381 GNUNET_free (msgw->msg); 382 GNUNET_free (msgw->msg);
382 GNUNET_free (msgw); 383 GNUNET_free (msgw);
383 removed = GNUNET_YES; 384 removed = GNUNET_YES;
@@ -442,7 +443,8 @@ unix_transport_server_stop (void *cls)
442 { 443 {
443 GNUNET_CONTAINER_DLL_remove (plugin->msg_head, plugin->msg_tail, msgw); 444 GNUNET_CONTAINER_DLL_remove (plugin->msg_head, plugin->msg_tail, msgw);
444 if (msgw->cont != NULL) 445 if (msgw->cont != NULL)
445 msgw->cont (msgw->cont_cls, &msgw->session->target, GNUNET_SYSERR); 446 msgw->cont (msgw->cont_cls, &msgw->session->target, GNUNET_SYSERR,
447 msgw->msgsize, 0);
446 GNUNET_free (msgw->msg); 448 GNUNET_free (msgw->msg);
447 GNUNET_free (msgw); 449 GNUNET_free (msgw);
448 } 450 }
@@ -508,7 +510,7 @@ unix_real_send (void *cls,
508 /* We do not have a send handle */ 510 /* We do not have a send handle */
509 GNUNET_break (0); 511 GNUNET_break (0);
510 if (cont != NULL) 512 if (cont != NULL)
511 cont (cont_cls, target, GNUNET_SYSERR); 513 cont (cont_cls, target, GNUNET_SYSERR, msgbuf_size, 0);
512 return -1; 514 return -1;
513 } 515 }
514 if ((addr == NULL) || (addrlen == 0)) 516 if ((addr == NULL) || (addrlen == 0))
@@ -516,7 +518,7 @@ unix_real_send (void *cls,
516 /* Can never send if we don't have an address */ 518 /* Can never send if we don't have an address */
517 GNUNET_break (0); 519 GNUNET_break (0);
518 if (cont != NULL) 520 if (cont != NULL)
519 cont (cont_cls, target, GNUNET_SYSERR); 521 cont (cont_cls, target, GNUNET_SYSERR, msgbuf_size, 0);
520 return -1; 522 return -1;
521 } 523 }
522 524
@@ -598,9 +600,9 @@ unix_real_send (void *cls,
598 if (cont != NULL) 600 if (cont != NULL)
599 { 601 {
600 if (sent == GNUNET_SYSERR) 602 if (sent == GNUNET_SYSERR)
601 cont (cont_cls, target, GNUNET_SYSERR); 603 cont (cont_cls, target, GNUNET_SYSERR, msgbuf_size, 0);
602 if (sent > 0) 604 if (sent > 0)
603 cont (cont_cls, target, GNUNET_OK); 605 cont (cont_cls, target, GNUNET_OK, msgbuf_size, msgbuf_size);
604 } 606 }
605 607
606 /* return number of bytes successfully sent */ 608 /* return number of bytes successfully sent */
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index 49fe101b7..d23608db9 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -260,6 +260,16 @@ struct FragmentMessage
260 */ 260 */
261 void *cont_cls; 261 void *cont_cls;
262 262
263 /**
264 * Size of original message
265 */
266 size_t size_payload;
267
268 /**
269 * Number of bytes used to transmit message
270 */
271 size_t size_on_wire;
272
263}; 273};
264 274
265 275
@@ -745,6 +755,7 @@ transmit_fragment (void *cls,
745 &radio_header->header, 755 &radio_header->header,
746 GNUNET_NO, 756 GNUNET_NO,
747 &fragment_transmission_done, fm); 757 &fragment_transmission_done, fm);
758 fm->size_on_wire += size;
748 if (NULL != fm->sh) 759 if (NULL != fm->sh)
749 GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# WLAN message fragments sent"), 760 GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# WLAN message fragments sent"),
750 1, GNUNET_NO); 761 1, GNUNET_NO);
@@ -804,7 +815,7 @@ fragmentmessage_timeout (void *cls,
804 fm->timeout_task = GNUNET_SCHEDULER_NO_TASK; 815 fm->timeout_task = GNUNET_SCHEDULER_NO_TASK;
805 if (NULL != fm->cont) 816 if (NULL != fm->cont)
806 { 817 {
807 fm->cont (fm->cont_cls, &fm->target, GNUNET_SYSERR); 818 fm->cont (fm->cont_cls, &fm->target, GNUNET_SYSERR, fm->size_payload, fm->size_on_wire);
808 fm->cont = NULL; 819 fm->cont = NULL;
809 } 820 }
810 free_fragment_message (fm); 821 free_fragment_message (fm);
@@ -818,6 +829,7 @@ fragmentmessage_timeout (void *cls,
818 * @param timeout how long can the message wait? 829 * @param timeout how long can the message wait?
819 * @param target peer that should receive the message 830 * @param target peer that should receive the message
820 * @param msg message to transmit 831 * @param msg message to transmit
832 * @param bytes of payload
821 * @param cont continuation to call once the message has 833 * @param cont continuation to call once the message has
822 * been transmitted (or if the transport is ready 834 * been transmitted (or if the transport is ready
823 * for the next transmission call; or if the 835 * for the next transmission call; or if the
@@ -829,6 +841,7 @@ send_with_fragmentation (struct MacEndpoint *endpoint,
829 struct GNUNET_TIME_Relative timeout, 841 struct GNUNET_TIME_Relative timeout,
830 const struct GNUNET_PeerIdentity *target, 842 const struct GNUNET_PeerIdentity *target,
831 const struct GNUNET_MessageHeader *msg, 843 const struct GNUNET_MessageHeader *msg,
844 size_t payload_size,
832 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) 845 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
833 846
834{ 847{
@@ -839,6 +852,8 @@ send_with_fragmentation (struct MacEndpoint *endpoint,
839 fm = GNUNET_malloc (sizeof (struct FragmentMessage)); 852 fm = GNUNET_malloc (sizeof (struct FragmentMessage));
840 fm->macendpoint = endpoint; 853 fm->macendpoint = endpoint;
841 fm->target = *target; 854 fm->target = *target;
855 fm->size_payload = payload_size;
856 fm->size_on_wire = 0;
842 fm->timeout = GNUNET_TIME_relative_to_absolute (timeout); 857 fm->timeout = GNUNET_TIME_relative_to_absolute (timeout);
843 fm->cont = cont; 858 fm->cont = cont;
844 fm->cont_cls = cont_cls; 859 fm->cont_cls = cont_cls;
@@ -1079,6 +1094,7 @@ wlan_plugin_send (void *cls,
1079 to, 1094 to,
1080 &session->target, 1095 &session->target,
1081 &wlanheader->header, 1096 &wlanheader->header,
1097 msgbuf_size,
1082 cont, cont_cls); 1098 cont, cont_cls);
1083 return size; 1099 return size;
1084} 1100}
@@ -1177,7 +1193,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
1177 mas->endpoint->timeout = GNUNET_TIME_relative_to_absolute (MACENDPOINT_TIMEOUT); 1193 mas->endpoint->timeout = GNUNET_TIME_relative_to_absolute (MACENDPOINT_TIMEOUT);
1178 if (NULL != fm->cont) 1194 if (NULL != fm->cont)
1179 { 1195 {
1180 fm->cont (fm->cont_cls, &fm->target, GNUNET_OK); 1196 fm->cont (fm->cont_cls, &fm->target, GNUNET_OK, fm->size_payload, fm->size_on_wire);
1181 fm->cont = NULL; 1197 fm->cont = NULL;
1182 } 1198 }
1183 free_fragment_message (fm); 1199 free_fragment_message (fm);