[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r28527 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r28527 - gnunet/src/transport |
Date: |
Mon, 12 Aug 2013 15:54:33 +0200 |
Author: grothoff
Date: 2013-08-12 15:54:33 +0200 (Mon, 12 Aug 2013)
New Revision: 28527
Modified:
gnunet/src/transport/Makefile.am
gnunet/src/transport/gnunet-service-transport_manipulation.c
gnunet/src/transport/test_plugin_transport.c
gnunet/src/transport/test_transport_api_manipulation_cfg_peer1.conf
gnunet/src/transport/test_transport_api_manipulation_cfg_peer2.conf
gnunet/src/transport/transport.conf.in
Log:
-more code migration to microseconds:
Modified: gnunet/src/transport/Makefile.am
===================================================================
--- gnunet/src/transport/Makefile.am 2013-08-12 13:45:44 UTC (rev 28526)
+++ gnunet/src/transport/Makefile.am 2013-08-12 13:54:33 UTC (rev 28527)
@@ -593,7 +593,7 @@
$(top_builddir)/src/hello/libgnunethello.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/transport/libgnunettransporttesting.la
-
+
test_plugin_udp_SOURCES = \
test_plugin_transport.c
test_plugin_udp_LDADD = \
Modified: gnunet/src/transport/gnunet-service-transport_manipulation.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_manipulation.c
2013-08-12 13:45:44 UTC (rev 28526)
+++ gnunet/src/transport/gnunet-service-transport_manipulation.c
2013-08-12 13:54:33 UTC (rev 28527)
@@ -578,42 +578,62 @@
void
GST_manipulation_init (const struct GNUNET_CONFIGURATION_Handle *GST_cfg)
{
- unsigned long long tmp;
-
- if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg,
- "transport", "MANIPULATE_DISTANCE_IN", &tmp) && (tmp >
0))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Setting inbound
distance_in to %u\n",
- (unsigned long long) tmp);
- set_metric (&man_handle.general, TM_RECEIVE,
GNUNET_ATS_QUALITY_NET_DISTANCE, tmp);
- }
-
- if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg,
- "transport", "MANIPULATE_DISTANCE_OUT", &tmp) && (tmp >
0))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Setting outbound
distance_in to %u\n",
- (unsigned long long) tmp);
- set_metric (&man_handle.general, TM_SEND,
GNUNET_ATS_QUALITY_NET_DISTANCE, tmp);
- }
-
- if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg,
- "transport", "MANIPULATE_DELAY_IN", &tmp) && (tmp > 0))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Delaying inbound traffic
for %llu ms\n",
- (unsigned long long) tmp);
- set_metric (&man_handle.general, TM_RECEIVE,
GNUNET_ATS_QUALITY_NET_DELAY, tmp);
- }
-
-
- if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg,
- "transport", "MANIPULATE_DELAY_OUT", &tmp) && (tmp > 0))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Delaying outbound traffic
for %llu ms\n",
- (unsigned long long) tmp);
- set_metric (&man_handle.general, TM_SEND,
GNUNET_ATS_QUALITY_NET_DELAY, tmp);
- }
-
- man_handle.peers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
+ unsigned long long tmp;
+ struct GNUNET_TIME_Relative delay;
+
+ if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg,
+ "transport",
+
"MANIPULATE_DISTANCE_IN",
+ &tmp)) &&
+ (tmp > 0) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Setting inbound distance_in to %llu\n",
+ (unsigned long long) tmp);
+ set_metric (&man_handle.general, TM_RECEIVE,
GNUNET_ATS_QUALITY_NET_DISTANCE, tmp);
+ }
+
+ if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (GST_cfg,
+ "transport",
+
"MANIPULATE_DISTANCE_OUT",
+ &tmp)) &&
+ (tmp > 0) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Setting outbound distance_in to %llu\n",
+ (unsigned long long) tmp);
+ set_metric (&man_handle.general, TM_SEND,
+ GNUNET_ATS_QUALITY_NET_DISTANCE, tmp);
+ }
+
+ if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (GST_cfg,
+ "transport",
+ "MANIPULATE_DELAY_IN",
+ &delay)) &&
+ (delay.rel_value_us > 0) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Delaying inbound traffic for %s\n",
+ GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
+ set_metric (&man_handle.general, TM_RECEIVE,
+ GNUNET_ATS_QUALITY_NET_DELAY,
+ delay.rel_value_us);
+ }
+ if ( (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (GST_cfg,
+ "transport",
+
"MANIPULATE_DELAY_OUT",
+ &delay)) &&
+ (delay.rel_value_us > 0) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Delaying outbound traffic for %s\n",
+ GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
+ set_metric (&man_handle.general,
+ TM_SEND,
+ GNUNET_ATS_QUALITY_NET_DELAY,
+ delay.rel_value_us);
+ }
+ man_handle.peers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
}
@@ -622,33 +642,36 @@
const struct GNUNET_HashCode * key,
void *value)
{
- struct DelayQueueEntry *dqe;
- struct DelayQueueEntry *next;
- if (NULL != value)
- {
- struct TM_Peer *tmp = (struct TM_Peer *) value;
- if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove
(man_handle.peers, key, value))
- GNUNET_break (0);
- free_metric (tmp);
- next = tmp->send_head;
- while (NULL != (dqe = next))
- {
- next = dqe->next;
- GNUNET_CONTAINER_DLL_remove
(tmp->send_head, tmp->send_tail, dqe);
- if (NULL != dqe->cont)
- dqe->cont
(dqe->cont_cls, GNUNET_SYSERR, dqe->msg_size, 0);
- GNUNET_free (dqe);
- }
- if (GNUNET_SCHEDULER_NO_TASK != tmp->send_delay_task)
- {
- GNUNET_SCHEDULER_cancel
(tmp->send_delay_task);
- tmp->send_delay_task =
GNUNET_SCHEDULER_NO_TASK;
- }
- GNUNET_free (tmp);
- }
- return GNUNET_OK;
+ struct DelayQueueEntry *dqe;
+ struct DelayQueueEntry *next;
+
+ if (NULL != value)
+ {
+ struct TM_Peer *tmp = (struct TM_Peer *) value;
+
+ if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (man_handle.peers,
key, value))
+ GNUNET_break (0);
+ free_metric (tmp);
+ next = tmp->send_head;
+ while (NULL != (dqe = next))
+ {
+ next = dqe->next;
+ GNUNET_CONTAINER_DLL_remove (tmp->send_head, tmp->send_tail, dqe);
+ if (NULL != dqe->cont)
+ dqe->cont (dqe->cont_cls, GNUNET_SYSERR, dqe->msg_size, 0);
+ GNUNET_free (dqe);
+ }
+ if (GNUNET_SCHEDULER_NO_TASK != tmp->send_delay_task)
+ {
+ GNUNET_SCHEDULER_cancel (tmp->send_delay_task);
+ tmp->send_delay_task = GNUNET_SCHEDULER_NO_TASK;
+ }
+ GNUNET_free (tmp);
+ }
+ return GNUNET_OK;
}
+
/**
* Notify manipulation about disconnect so it can discard queued messages
*
Modified: gnunet/src/transport/test_plugin_transport.c
===================================================================
--- gnunet/src/transport/test_plugin_transport.c 2013-08-12 13:45:44 UTC
(rev 28526)
+++ gnunet/src/transport/test_plugin_transport.c 2013-08-12 13:54:33 UTC
(rev 28527)
@@ -197,6 +197,7 @@
{
struct AddressWrapper *w;
int c = 0;
+
timeout_endbadly = GNUNET_SCHEDULER_NO_TASK;
if (GNUNET_SCHEDULER_NO_TASK != timeout_wait)
{
@@ -350,7 +351,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Adding address of length %u\n", addrlen);
- w = GNUNET_malloc (sizeof (struct AddressWrapper));
+ w = GNUNET_new (struct AddressWrapper);
w->addr = GNUNET_malloc (addrlen);
w->addrlen = addrlen;
memcpy (w->addr, addr, addrlen);
@@ -523,7 +524,6 @@
env.my_identity = &my_identity;
env.max_connections = max_connect_per_transport;
env.stats = stats;
-
env.receive = &env_receive;
env.notify_address = &env_notify_address;
env.get_address_type = &env_get_address_type;
@@ -532,6 +532,7 @@
env.session_end = &env_session_end;
}
+
static int
handle_helper_message (void *cls, void *client,
const struct GNUNET_MessageHeader *hdr)
Modified: gnunet/src/transport/test_transport_api_manipulation_cfg_peer1.conf
===================================================================
--- gnunet/src/transport/test_transport_api_manipulation_cfg_peer1.conf
2013-08-12 13:45:44 UTC (rev 28526)
+++ gnunet/src/transport/test_transport_api_manipulation_cfg_peer1.conf
2013-08-12 13:54:33 UTC (rev 28527)
@@ -27,5 +27,5 @@
PORT = 12001
UNIXPATH = /tmp/gnunet-p1-service-transport.sock
PLUGINS = tcp
-MANIPULATE_DELAY_IN = 100
-MANIPULATE_DELAY_OUT = 100
\ No newline at end of file
+MANIPULATE_DELAY_IN = 100 ms
+MANIPULATE_DELAY_OUT = 100 ms
\ No newline at end of file
Modified: gnunet/src/transport/test_transport_api_manipulation_cfg_peer2.conf
===================================================================
--- gnunet/src/transport/test_transport_api_manipulation_cfg_peer2.conf
2013-08-12 13:45:44 UTC (rev 28526)
+++ gnunet/src/transport/test_transport_api_manipulation_cfg_peer2.conf
2013-08-12 13:54:33 UTC (rev 28527)
@@ -27,5 +27,5 @@
PORT = 12010
PLUGINS = tcp
UNIXPATH = /tmp/gnunet-p2-service-transport.sock
-#MANIPULATE_DELAY_IN = 0
-#MANIPULATE_DELAY_OUT = 0
+#MANIPULATE_DELAY_IN = 0 ms
+#MANIPULATE_DELAY_OUT = 0 ms
Modified: gnunet/src/transport/transport.conf.in
===================================================================
--- gnunet/src/transport/transport.conf.in 2013-08-12 13:45:44 UTC (rev
28526)
+++ gnunet/src/transport/transport.conf.in 2013-08-12 13:54:33 UTC (rev
28527)
@@ -26,10 +26,10 @@
# Configuration settings related to traffic manipulation for testing purposes
# Distance
# MANIPULATE_DISTANCE_IN = 1
-# MANIPULATE_DISTANCE_OUT = 1
-# Delay in ms; WARNING: to large values may lead to peers not connecting!
-# MANIPULATE_DELAY_IN = 1
-# MANIPULATE_DELAY_OUT = 1
+# MANIPULATE_DISTANCE_OUT = 1
+# Delay; WARNING: to large values may lead to peers not connecting!
+# MANIPULATE_DELAY_IN = 1 ms
+# MANIPULATE_DELAY_OUT = 1 ms
[transport-unix]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r28527 - gnunet/src/transport,
gnunet <=