From df5464844b69488e0e14759a0461360ad164e509 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Wed, 18 Dec 2013 15:06:30 +0000 Subject: new timeout tests for WLAN and bluetooth session timeout for WLAN --- src/transport/Makefile.am | 24 +++++++++++++++ src/transport/plugin_transport_wlan.c | 4 +++ ...test_transport_api_timeout_bluetooth_peer1.conf | 35 ++++++++++++++++++++++ ...test_transport_api_timeout_bluetooth_peer2.conf | 34 +++++++++++++++++++++ .../test_transport_api_timeout_wlan_peer1.conf | 35 ++++++++++++++++++++++ .../test_transport_api_timeout_wlan_peer2.conf | 34 +++++++++++++++++++++ 6 files changed, 166 insertions(+) create mode 100644 src/transport/test_transport_api_timeout_bluetooth_peer1.conf create mode 100644 src/transport/test_transport_api_timeout_bluetooth_peer2.conf create mode 100644 src/transport/test_transport_api_timeout_wlan_peer1.conf create mode 100644 src/transport/test_transport_api_timeout_wlan_peer2.conf diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index bb30e4cea..2e49b0cf0 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -53,6 +53,7 @@ if LINUX WLAN_PLUGIN_LA = libgnunet_plugin_transport_wlan.la WLAN_PLUGIN_TEST = test_plugin_wlan WLAN_API_TEST = test_transport_api_wlan + WLAN_TIMEOUT_TEST = test_transport_api_timeout_wlan WLAN_REL_TEST = test_transport_api_reliability_wlan WLAN_UREL_TEST = test_transport_api_unreliability_wlan WLAN_QUOTA_TEST = test_quota_compliance_wlan \ @@ -72,6 +73,7 @@ if HAVE_LIBBLUETOOTH BT_PLUGIN_LA = libgnunet_plugin_transport_bluetooth.la BT_PLUGIN_TEST = test_plugin_bluetooth BT_API_TEST = test_transport_api_bluetooth + BT_TIMEOUT_TEST = test_transport_api_timeout_bluetooth BT_REL_TEST = test_transport_api_reliability_bluetooth BT_UREL_TEST = test_transport_api_unreliability_bluetooth BT_QUOTA_TEST = test_quota_compliance_bluetooth \ @@ -398,7 +400,9 @@ check_PROGRAMS = \ $(HTTPS_API_TEST) \ $(HTTPS_API_TIMEOUT_TEST) \ $(WLAN_API_TEST) \ + $(WLAN_TIMEOUT_TEST) \ $(BT_API_TEST) \ + $(BT_TIMEOUT_TEST) \ test_transport_api_multi \ test_transport_blacklisting_no_bl \ test_transport_blacklisting_outbound_bl_full \ @@ -786,6 +790,22 @@ test_transport_api_timeout_unix_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/transport/libgnunettransporttesting.la +test_transport_api_timeout_wlan_SOURCES = \ + test_transport_api_timeout.c +test_transport_api_timeout_wlan_LDADD = \ + $(top_builddir)/src/transport/libgnunettransport.la \ + $(top_builddir)/src/hello/libgnunethello.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/transport/libgnunettransporttesting.la + +test_transport_api_timeout_bluetooth_SOURCES = \ + test_transport_api_timeout.c +test_transport_api_timeout_bluetooth_LDADD = \ + $(top_builddir)/src/transport/libgnunettransport.la \ + $(top_builddir)/src/hello/libgnunethello.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/transport/libgnunettransporttesting.la + test_transport_api_reliability_tcp_nat_SOURCES = \ test_transport_api_reliability.c test_transport_api_reliability_tcp_nat_LDADD = \ @@ -1155,6 +1175,10 @@ test_transport_api_unix_peer1.conf\ test_transport_api_unix_peer2.conf\ test_transport_api_timeout_unix_peer1.conf\ test_transport_api_timeout_unix_peer2.conf\ +test_transport_api_timeout_wlan_peer1.conf \ +test_transport_api_timeout_wlan_peer2.conf \ +test_transport_api_timeout_bluetooth_peer1.conf\ +test_transport_api_timeout_bluetooth_peer2.conf\ test_transport_api_unreliability_udp_peer1.conf\ test_transport_api_unreliability_udp_peer2.conf\ test_transport_api_unreliability_unix_peer1.conf\ diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index 212394248..6f5c66ad3 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c @@ -1861,7 +1861,11 @@ wlan_plugin_update_session_timeout (void *cls, const struct GNUNET_PeerIdentity *peer, struct Session *session) { + if (session->timeout_task != GNUNET_SCHEDULER_NO_TASK) + GNUNET_SCHEDULER_cancel (session->timeout_task); + session->timeout_task = GNUNET_SCHEDULER_add_delayed ( + GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, &session_timeout, session); } /** diff --git a/src/transport/test_transport_api_timeout_bluetooth_peer1.conf b/src/transport/test_transport_api_timeout_bluetooth_peer1.conf new file mode 100644 index 000000000..d63bca939 --- /dev/null +++ b/src/transport/test_transport_api_timeout_bluetooth_peer1.conf @@ -0,0 +1,35 @@ +@INLINE@ template_cfg_peer1.conf +[PATHS] +GNUNET_TEST_HOME = /tmp/test-transport/api-bluetooth-p1/ + +[transport-bluetooth] +INTERFACE = hci0 +TESTMODE = 1 + +[arm] +PORT = 12164 +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock + +[statistics] +PORT = 12163 +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock + +[resolver] +PORT = 12162 +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock + +[peerinfo] +PORT = 12161 +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock + +[transport] +PORT = 12160 +PLUGINS = bluetooth +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock +#PREFIX = xterm -T transport2 -e gdb --command=cmd --args +#PREFIX = valgrind --leak-check=full --show-reachable=yes --main-stacksize=104857600 +#PREFIX = valgrind --leak-check=full --show-reachable=yes +#PREFIX = valgrind --leak-check=full +#PREFIX = valgrind --tool=massif +#PREFIX = gdbserver :2345 + diff --git a/src/transport/test_transport_api_timeout_bluetooth_peer2.conf b/src/transport/test_transport_api_timeout_bluetooth_peer2.conf new file mode 100644 index 000000000..4a19cddf5 --- /dev/null +++ b/src/transport/test_transport_api_timeout_bluetooth_peer2.conf @@ -0,0 +1,34 @@ +@INLINE@ template_cfg_peer2.conf +[PATHS] +GNUNET_TEST_HOME = /tmp/test-transport/api-bluetooth-p2/ + +[transport-bluetooth] +INTERFACE = hci1 +TESTMODE = 2 + +[arm] +PORT = 12174 +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock + +[statistics] +PORT = 12173 +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock + +[resolver] +PORT = 12172 +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock + +[peerinfo] +PORT = 12171 +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock + +[transport] +PORT = 12170 +PLUGINS = bluetooth +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock +#PREFIX = xterm -T transport2 -e gdb --command=cmd --args +#PREFIX = valgrind --leak-check=full --show-reachable=yes --main-stacksize=104857600 +#PREFIX = valgrind --leak-check=full --show-reachable=yes +#PREFIX = valgrind --leak-check=full +#PREFIX = valgrind --tool=massif +#PREFIX = gdbserver :2345 diff --git a/src/transport/test_transport_api_timeout_wlan_peer1.conf b/src/transport/test_transport_api_timeout_wlan_peer1.conf new file mode 100644 index 000000000..8b870f1d4 --- /dev/null +++ b/src/transport/test_transport_api_timeout_wlan_peer1.conf @@ -0,0 +1,35 @@ +@INLINE@ template_cfg_peer1.conf +[PATHS] +GNUNET_TEST_HOME = /tmp/test-transport/api-wlan-p1/ + +[transport-wlan] +INTERFACE = mon0 +TESTMODE = 1 + +[arm] +PORT = 12164 +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock + +[statistics] +PORT = 12163 +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock + +[resolver] +PORT = 12162 +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock + +[peerinfo] +PORT = 12161 +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock + +[transport] +PORT = 12160 +PLUGINS = wlan +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock +#PREFIX = xterm -T transport2 -e gdb --command=cmd --args +#PREFIX = valgrind --leak-check=full --show-reachable=yes --main-stacksize=104857600 +#PREFIX = valgrind --leak-check=full --show-reachable=yes +#PREFIX = valgrind --leak-check=full +#PREFIX = valgrind --tool=massif +#PREFIX = gdbserver :2345 + diff --git a/src/transport/test_transport_api_timeout_wlan_peer2.conf b/src/transport/test_transport_api_timeout_wlan_peer2.conf new file mode 100644 index 000000000..c32ce5ced --- /dev/null +++ b/src/transport/test_transport_api_timeout_wlan_peer2.conf @@ -0,0 +1,34 @@ +@INLINE@ template_cfg_peer2.conf +[PATHS] +GNUNET_TEST_HOME = /tmp/test-transport/api-wlan-p2/ + +[transport-wlan] +INTERFACE = mon1 +TESTMODE = 2 + +[arm] +PORT = 12174 +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock + +[statistics] +PORT = 12173 +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock + +[resolver] +PORT = 12172 +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock + +[peerinfo] +PORT = 12171 +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock + +[transport] +PORT = 12170 +PLUGINS = wlan +UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock +#PREFIX = xterm -T transport2 -e gdb --command=cmd --args +#PREFIX = valgrind --leak-check=full --show-reachable=yes --main-stacksize=104857600 +#PREFIX = valgrind --leak-check=full --show-reachable=yes +#PREFIX = valgrind --leak-check=full +#PREFIX = valgrind --tool=massif +#PREFIX = gdbserver :2345 -- cgit v1.2.3