[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r24341 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r24341 - gnunet/src/transport |
Date: |
Tue, 16 Oct 2012 15:25:40 +0200 |
Author: wachs
Date: 2012-10-16 15:25:39 +0200 (Tue, 16 Oct 2012)
New Revision: 24341
Modified:
gnunet/src/transport/gnunet-service-transport_clients.c
gnunet/src/transport/plugin_transport_udp.c
gnunet/src/transport/transport.h
gnunet/src/transport/transport_api.c
Log:
changes
Modified: gnunet/src/transport/gnunet-service-transport_clients.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_clients.c 2012-10-16
12:19:44 UTC (rev 24340)
+++ gnunet/src/transport/gnunet-service-transport_clients.c 2012-10-16
13:25:39 UTC (rev 24341)
@@ -568,10 +568,18 @@
struct SendTransmitContinuationContext *stcc = cls;
struct SendOkMessage send_ok_msg;
- //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Payload: %u, On wire %u \n",
bytes_payload, bytes_on_wire);
+ //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Payload: %u, On wire %u result:
%i\n", bytes_payload, bytes_on_wire, success);
+ /*
+ if (GNUNET_OK == success)
+ GNUNET_assert (bytes_on_wire >= bytes_payload);
+ else
+ GNUNET_assert (bytes_on_wire <= bytes_payload);
+*/
send_ok_msg.header.size = htons (sizeof (send_ok_msg));
send_ok_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK);
+ send_ok_msg.bytes_msg = htonl (bytes_payload);
+ send_ok_msg.bytes_physical = htonl (bytes_on_wire);
send_ok_msg.success = htonl (success);
send_ok_msg.latency =
GNUNET_TIME_relative_hton (GNUNET_TIME_UNIT_FOREVER_REL);
Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2012-10-16 12:19:44 UTC (rev
24340)
+++ gnunet/src/transport/plugin_transport_udp.c 2012-10-16 13:25:39 UTC (rev
24341)
@@ -692,12 +692,11 @@
(GNUNET_OK == result) ? "OK" : "SYSERR");
if (NULL != udpw->cont)
{
- /* FIXME: add bytes used on wire here */
- /* Calls transport continuation if message was not fragmented,
- * GNUNET_FRAGMENT if just an fragment was sent
+ /* Call continuation for fragmented message */
+ /*
+ * Transport continuation for unfragmented message
+ * send_next_fragment for fragmented message
*/
-
- /* Call continuation for fragmented message */
udpw->cont (udpw->cont_cls, &udpw->session->target, result,
udpw->payload_size, udpw->msg_size);
}
@@ -1233,7 +1232,6 @@
udpw->timeout = frag_ctx->timeout;
udpw->frag_ctx = frag_ctx;
memcpy (udpw->msg_buf, msg, msg_len);
- frag_ctx->on_wire_size += msg_len;
enqueue (plugin, udpw);
schedule_select (plugin);
}
@@ -2072,7 +2070,11 @@
GNUNET_STATISTICS_update (plugin->env->stats,
"# bytes transmitted via UDP",
sent, GNUNET_NO);
- call_continuation(udpw, GNUNET_OK);
+ if (NULL != udpw->frag_ctx)
+ {
+ udpw->frag_ctx->on_wire_size += udpw->msg_size;
+ }
+ call_continuation (udpw, GNUNET_OK);
network_down_error = GNUNET_NO;
}
Modified: gnunet/src/transport/transport.h
===================================================================
--- gnunet/src/transport/transport.h 2012-10-16 12:19:44 UTC (rev 24340)
+++ gnunet/src/transport/transport.h 2012-10-16 13:25:39 UTC (rev 24341)
@@ -262,7 +262,19 @@
*/
uint32_t success GNUNET_PACKED;
+
/**
+ * Size of message sent
+ */
+ uint32_t bytes_msg GNUNET_PACKED;
+
+ /**
+ * Size of message sent over wire
+ * Includes plugin and protocol specific overhead
+ */
+ uint32_t bytes_physical GNUNET_PACKED;
+
+ /**
* Latency estimate.
*/
struct GNUNET_TIME_RelativeNBO latency;
Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c 2012-10-16 12:19:44 UTC (rev
24340)
+++ gnunet/src/transport/transport_api.c 2012-10-16 13:25:39 UTC (rev
24341)
@@ -146,6 +146,11 @@
*/
int is_ready;
+ /**
+ * Sending consumed more bytes on wire than payload was announced
+ * This overhead is added to the delay of next sending operation
+ */
+ size_t traffic_overhead;
};
@@ -348,6 +353,7 @@
n->id = *pid;
n->h = h;
n->is_ready = GNUNET_YES;
+ n->traffic_overhead = 0;
GNUNET_BANDWIDTH_tracker_init (&n->out_tracker,
GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT,
MAX_BANDWIDTH_CARRY_S);
@@ -410,6 +416,8 @@
struct GNUNET_PeerIdentity me;
uint16_t size;
uint32_t ats_count;
+ uint32_t bytes_msg;
+ uint32_t bytes_physical;
GNUNET_assert (h->client != NULL);
if (msg == NULL)
@@ -508,11 +516,22 @@
break;
}
okm = (const struct SendOkMessage *) msg;
+ bytes_msg = ntohl (okm->bytes_msg);
+ bytes_physical = ntohl (okm->bytes_physical);
LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message, transmission %s.\n",
"SEND_OK", ntohl (okm->success) == GNUNET_OK ? "succeeded" :
"failed");
+
n = neighbour_find (h, &okm->peer);
if (n == NULL)
break;
+
+ GNUNET_assert (0 == n->traffic_overhead);
+ if (bytes_physical >= bytes_msg)
+ {
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Overhead for %u byte message: %u \n",
+ bytes_msg, bytes_physical - bytes_msg);
+ n->traffic_overhead = bytes_physical - bytes_msg;
+ }
GNUNET_break (GNUNET_NO == n->is_ready);
n->is_ready = GNUNET_YES;
if ((n->th != NULL) && (n->hn == NULL))
@@ -783,9 +802,12 @@
if (NULL != h->control_head)
delay = GNUNET_TIME_UNIT_ZERO;
else if (NULL != (n = GNUNET_CONTAINER_heap_peek (h->ready_heap)))
+ {
delay =
GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker,
- n->th->notify_size);
+ n->th->notify_size +
n->traffic_overhead);
+ n->traffic_overhead = 0;
+ }
else
return; /* no work to be done */
LOG (GNUNET_ERROR_TYPE_DEBUG,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r24341 - gnunet/src/transport,
gnunet <=