aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL107
-rw-r--r--TODO22
-rw-r--r--src/Makefile.am1
-rw-r--r--src/arm/arm_api.c1
-rw-r--r--src/arm/gnunet-service-arm.c1
-rw-r--r--src/fs/test_fs_namespace_data.conf42
-rw-r--r--src/include/gnunet_client_lib.h5
-rw-r--r--src/testing/test_testing.c5
-rw-r--r--src/testing/test_testing_data.conf2
-rw-r--r--src/testing/testing.c36
-rw-r--r--src/transport/gnunet-service-transport.c81
-rw-r--r--src/transport/plugin_transport_tcp.c5
-rw-r--r--src/util/client.c23
-rw-r--r--src/util/test_service.c1
14 files changed, 241 insertions, 91 deletions
diff --git a/INSTALL b/INSTALL
index d3c5b40a9..2550dab75 100644
--- a/INSTALL
+++ b/INSTALL
@@ -2,15 +2,15 @@ Installation Instructions
2************************* 2*************************
3 3
4Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 4Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
52006, 2007 Free Software Foundation, Inc. 52006, 2007, 2008, 2009 Free Software Foundation, Inc.
6 6
7This file is free documentation; the Free Software Foundation gives 7 This file is free documentation; the Free Software Foundation gives
8unlimited permission to copy, distribute and modify it. 8unlimited permission to copy, distribute and modify it.
9 9
10Basic Installation 10Basic Installation
11================== 11==================
12 12
13Briefly, the shell commands `./configure; make; make install' should 13 Briefly, the shell commands `./configure; make; make install' should
14configure, build, and install this package. The following 14configure, build, and install this package. The following
15more-detailed instructions are generic; see the `README' file for 15more-detailed instructions are generic; see the `README' file for
16instructions specific to this package. 16instructions specific to this package.
@@ -73,9 +73,9 @@ The simplest way to compile this package is:
73Compilers and Options 73Compilers and Options
74===================== 74=====================
75 75
76Some systems require unusual options for compilation or linking that the 76 Some systems require unusual options for compilation or linking that
77`configure' script does not know about. Run `./configure --help' for 77the `configure' script does not know about. Run `./configure --help'
78details on some of the pertinent environment variables. 78for details on some of the pertinent environment variables.
79 79
80 You can give `configure' initial values for configuration parameters 80 You can give `configure' initial values for configuration parameters
81by setting variables in the command line or in the environment. Here 81by setting variables in the command line or in the environment. Here
@@ -88,7 +88,7 @@ is an example:
88Compiling For Multiple Architectures 88Compiling For Multiple Architectures
89==================================== 89====================================
90 90
91You can compile the package for more than one kind of computer at the 91 You can compile the package for more than one kind of computer at the
92same time, by placing the object files for each architecture in their 92same time, by placing the object files for each architecture in their
93own directory. To do this, you can use GNU `make'. `cd' to the 93own directory. To do this, you can use GNU `make'. `cd' to the
94directory where you want the object files and executables to go and run 94directory where you want the object files and executables to go and run
@@ -100,10 +100,24 @@ architecture at a time in the source code directory. After you have
100installed the package for one architecture, use `make distclean' before 100installed the package for one architecture, use `make distclean' before
101reconfiguring for another architecture. 101reconfiguring for another architecture.
102 102
103 On MacOS X 10.5 and later systems, you can create libraries and
104executables that work on multiple system types--known as "fat" or
105"universal" binaries--by specifying multiple `-arch' options to the
106compiler but only a single `-arch' option to the preprocessor. Like
107this:
108
109 ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
110 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
111 CPP="gcc -E" CXXCPP="g++ -E"
112
113 This is not guaranteed to produce working output in all cases, you
114may have to build one architecture at a time and combine the results
115using the `lipo' tool if you have problems.
116
103Installation Names 117Installation Names
104================== 118==================
105 119
106By default, `make install' installs the package's commands under 120 By default, `make install' installs the package's commands under
107`/usr/local/bin', include files under `/usr/local/include', etc. You 121`/usr/local/bin', include files under `/usr/local/include', etc. You
108can specify an installation prefix other than `/usr/local' by giving 122can specify an installation prefix other than `/usr/local' by giving
109`configure' the option `--prefix=PREFIX'. 123`configure' the option `--prefix=PREFIX'.
@@ -126,7 +140,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
126Optional Features 140Optional Features
127================= 141=================
128 142
129Some packages pay attention to `--enable-FEATURE' options to 143 Some packages pay attention to `--enable-FEATURE' options to
130`configure', where FEATURE indicates an optional part of the package. 144`configure', where FEATURE indicates an optional part of the package.
131They may also pay attention to `--with-PACKAGE' options, where PACKAGE 145They may also pay attention to `--with-PACKAGE' options, where PACKAGE
132is something like `gnu-as' or `x' (for the X Window System). The 146is something like `gnu-as' or `x' (for the X Window System). The
@@ -138,14 +152,46 @@ find the X include and library files automatically, but if it doesn't,
138you can use the `configure' options `--x-includes=DIR' and 152you can use the `configure' options `--x-includes=DIR' and
139`--x-libraries=DIR' to specify their locations. 153`--x-libraries=DIR' to specify their locations.
140 154
155Particular systems
156==================
157
158 On HP-UX, the default C compiler is not ANSI C compatible. If GNU
159CC is not installed, it is recommended to use the following options in
160order to use an ANSI C compiler:
161
162 ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
163
164and if that doesn't work, install pre-built binaries of GCC for HP-UX.
165
166 On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
167parse its `<wchar.h>' header file. The option `-nodtk' can be used as
168a workaround. If GNU CC is not installed, it is therefore recommended
169to try
170
171 ./configure CC="cc"
172
173and if that doesn't work, try
174
175 ./configure CC="cc -nodtk"
176
177 On Solaris, don't put `/usr/ucb' early in your `PATH'. This
178directory contains several dysfunctional programs; working variants of
179these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
180in your `PATH', put it _after_ `/usr/bin'.
181
182 On Haiku, software installed for all users goes in `/boot/common',
183not `/usr/local'. It is recommended to use the following options:
184
185 ./configure --prefix=/boot/common
186
141Specifying the System Type 187Specifying the System Type
142========================== 188==========================
143 189
144There may be some features `configure' cannot figure out automatically, 190 There may be some features `configure' cannot figure out
145but needs to determine by the type of machine the package will run on. 191automatically, but needs to determine by the type of machine the package
146Usually, assuming the package is built to be run on the _same_ 192will run on. Usually, assuming the package is built to be run on the
147architectures, `configure' can figure that out, but if it prints a 193_same_ architectures, `configure' can figure that out, but if it prints
148message saying it cannot guess the machine type, give it the 194a message saying it cannot guess the machine type, give it the
149`--build=TYPE' option. TYPE can either be a short name for the system 195`--build=TYPE' option. TYPE can either be a short name for the system
150type, such as `sun4', or a canonical name which has the form: 196type, such as `sun4', or a canonical name which has the form:
151 197
@@ -153,7 +199,8 @@ type, such as `sun4', or a canonical name which has the form:
153 199
154where SYSTEM can have one of these forms: 200where SYSTEM can have one of these forms:
155 201
156 OS KERNEL-OS 202 OS
203 KERNEL-OS
157 204
158 See the file `config.sub' for the possible values of each field. If 205 See the file `config.sub' for the possible values of each field. If
159`config.sub' isn't included in this package, then this package doesn't 206`config.sub' isn't included in this package, then this package doesn't
@@ -171,9 +218,9 @@ eventually be run) with `--host=TYPE'.
171Sharing Defaults 218Sharing Defaults
172================ 219================
173 220
174If you want to set default values for `configure' scripts to share, you 221 If you want to set default values for `configure' scripts to share,
175can create a site shell script called `config.site' that gives default 222you can create a site shell script called `config.site' that gives
176values for variables like `CC', `cache_file', and `prefix'. 223default values for variables like `CC', `cache_file', and `prefix'.
177`configure' looks for `PREFIX/share/config.site' if it exists, then 224`configure' looks for `PREFIX/share/config.site' if it exists, then
178`PREFIX/etc/config.site' if it exists. Or, you can set the 225`PREFIX/etc/config.site' if it exists. Or, you can set the
179`CONFIG_SITE' environment variable to the location of the site script. 226`CONFIG_SITE' environment variable to the location of the site script.
@@ -182,7 +229,7 @@ A warning: not all `configure' scripts look for a site script.
182Defining Variables 229Defining Variables
183================== 230==================
184 231
185Variables not defined in a site shell script can be set in the 232 Variables not defined in a site shell script can be set in the
186environment passed to `configure'. However, some packages may run 233environment passed to `configure'. However, some packages may run
187configure again during the build, and the customized values of these 234configure again during the build, and the customized values of these
188variables may be lost. In order to avoid this problem, you should set 235variables may be lost. In order to avoid this problem, you should set
@@ -201,11 +248,19 @@ an Autoconf bug. Until the bug is fixed you can use this workaround:
201`configure' Invocation 248`configure' Invocation
202====================== 249======================
203 250
204`configure' recognizes the following options to control how it operates. 251 `configure' recognizes the following options to control how it
252operates.
205 253
206`--help' 254`--help'
207`-h' 255`-h'
208 Print a summary of the options to `configure', and exit. 256 Print a summary of all of the options to `configure', and exit.
257
258`--help=short'
259`--help=recursive'
260 Print a summary of the options unique to this package's
261 `configure', and exit. The `short' variant lists options used
262 only in the top level, while the `recursive' variant lists options
263 also present in any nested packages.
209 264
210`--version' 265`--version'
211`-V' 266`-V'
@@ -232,6 +287,16 @@ an Autoconf bug. Until the bug is fixed you can use this workaround:
232 Look for the package's source code in directory DIR. Usually 287 Look for the package's source code in directory DIR. Usually
233 `configure' can determine that directory automatically. 288 `configure' can determine that directory automatically.
234 289
290`--prefix=DIR'
291 Use DIR as the installation prefix. *Note Installation Names::
292 for more details, including other options available for fine-tuning
293 the installation locations.
294
295`--no-create'
296`-n'
297 Run the configure checks, but stop before creating any output
298 files.
299
235`configure' also accepts some other, not widely useful, options. Run 300`configure' also accepts some other, not widely useful, options. Run
236`configure --help' for more details. 301`configure --help' for more details.
237 302
diff --git a/TODO b/TODO
index e06e63790..a67b83bb8 100644
--- a/TODO
+++ b/TODO
@@ -1,25 +1,22 @@
1Implementable right now (but not necessarily important), with caveats 1Implementable right now (but not necessarily important), with caveats
2(unavailable components that will limit what can be implemented right 2(unavailable components that will limit what can be implemented right
3away), in order in which they will likely be done: 3away), in order in which they will likely be done:
4* TESTING 4* TESTING [Nate]
5* FS (DHT not available)
6* SETUP 5* SETUP
7* DV (distributed testing not available) 6* DV (distributed testing not available) [Nate]
8* TBENCH (distributed testing not available) 7* TBENCH (distributed testing not available)
9* TRACEKIT (distributed testing not available) 8* TRACEKIT (distributed testing not available)
9* FRAGMENTATION [Ji Lu]
10* HTTP transport 10* HTTP transport
11* FRAGMENTATION 11* MySQL / Postgres plugins (datastore, datacache) [Radhika]
12* MySQL / Postgres plugins (datastore, datacache) 12* UPNP [Milan]
13* UPNP
14 13
15Urgent items (before announcing ng.gnunet.org): 14Urgent items (before announcing ng.gnunet.org):
16* TESTING (needed for DV, DHT, Topology) 15* TESTING (needed for DV, DHT, Topology)
17 - implement library for local testing 16 - implement library for local testing
18 + modify configuration to allow controlling connections for non-local starts 17 + consider changing API for peer-group termination to
19 + CORE service does not start with valid peer ID (all zeros) -- testcase fails! 18 call continuation when done
20 + consider changing API for peer-group termination to call continuation when done
21 - implement testcases for library 19 - implement testcases for library
22 + get test for basic peer start to work!
23 + test basic peer connect 20 + test basic peer connect
24 + test group start 21 + test group start
25* TEST: 22* TEST:
@@ -89,6 +86,7 @@ Urgent items (before announcing ng.gnunet.org):
89 + default generation 86 + default generation
90 + need to settle basic design; do we want to keep guile? 87 + need to settle basic design; do we want to keep guile?
91 - testing (RC-pre0) 88 - testing (RC-pre0)
89 + modify configuration to allow controlling connections for non-local starts
92 + testbed creation with topology (needs working F2F topology) [Nate] 90 + testbed creation with topology (needs working F2F topology) [Nate]
93 + testbed with churn [Nate] 91 + testbed with churn [Nate]
94 + implement library for distributed testing [Nate] 92 + implement library for distributed testing [Nate]
@@ -146,7 +144,7 @@ Urgent items (before announcing ng.gnunet.org):
146 - create good Drupal theme for GNUnet 144 - create good Drupal theme for GNUnet
147 - make a NICE download page and figure out how to 145 - make a NICE download page and figure out how to
148 enable developers to publish TGZs nicely 146 enable developers to publish TGZs nicely
149 - port "contact" page; add impressum 147 - port "contact" page
150 - add content type for "todo" items? 148 - add content type for "todo" items?
151 - DNS activation 149 - DNS activation
152* Plugins to implement: 150* Plugins to implement:
diff --git a/src/Makefile.am b/src/Makefile.am
index 50d75916b..c30045c9b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,6 +20,7 @@ SUBDIRS = \
20 template \ 20 template \
21 transport \ 21 transport \
22 core \ 22 core \
23 testing \
23 $(HOSTLIST_DIR) \ 24 $(HOSTLIST_DIR) \
24 topology \ 25 topology \
25 fs \ 26 fs \
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c
index 00ddddaab..810f2ebe6 100644
--- a/src/arm/arm_api.c
+++ b/src/arm/arm_api.c
@@ -390,6 +390,7 @@ GNUNET_ARM_stop_service (struct GNUNET_ARM_Handle *h,
390 if (0 == strcmp ("arm", service_name)) 390 if (0 == strcmp ("arm", service_name))
391 { 391 {
392 GNUNET_CLIENT_service_shutdown (h->client); 392 GNUNET_CLIENT_service_shutdown (h->client);
393 h->client = NULL;
393 if (cb != NULL) 394 if (cb != NULL)
394 cb (cb_cls, GNUNET_NO); 395 cb (cb_cls, GNUNET_NO);
395 return; 396 return;
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c
index 9aeb620f4..63808d9c9 100644
--- a/src/arm/gnunet-service-arm.c
+++ b/src/arm/gnunet-service-arm.c
@@ -536,7 +536,6 @@ stop_service (struct GNUNET_SERVER_Client *client,
536 (NULL != (sc = GNUNET_CLIENT_connect (sched, servicename, cfg))) ) 536 (NULL != (sc = GNUNET_CLIENT_connect (sched, servicename, cfg))) )
537 { 537 {
538 GNUNET_CLIENT_service_shutdown (sc); 538 GNUNET_CLIENT_service_shutdown (sc);
539 GNUNET_CLIENT_disconnect (sc);
540 signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_DOWN); 539 signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_DOWN);
541 } 540 }
542 else 541 else
diff --git a/src/fs/test_fs_namespace_data.conf b/src/fs/test_fs_namespace_data.conf
new file mode 100644
index 000000000..d7c2af4c4
--- /dev/null
+++ b/src/fs/test_fs_namespace_data.conf
@@ -0,0 +1,42 @@
1[PATHS]
2SERVICEHOME = /tmp/gnunet-test-fs-namespace/
3DEFAULTCONFIG = test_fs_namespace_data.conf
4
5[gnunetd]
6HOSTKEY = $SERVICEHOME/.hostkey
7
8[resolver]
9PORT = 42464
10HOSTNAME = localhost
11
12[transport]
13PORT = 42465
14PLUGINS =
15
16[arm]
17PORT = 42466
18HOSTNAME = localhost
19DEFAULTSERVICES = resolver datastore transport core fs
20
21[datastore]
22#DEBUG = YES
23
24[statistics]
25PORT = 42467
26HOSTNAME = localhost
27
28[peerinfo]
29PORT = 42469
30HOSTNAME = localhost
31
32[core]
33PORT = 42470
34HOSTNAME = localhost
35
36[fs]
37PORT = 42471
38HOSTNAME = localhost
39#DEBUG = YES
40
41[testing]
42WEAKRANDOM = YES
diff --git a/src/include/gnunet_client_lib.h b/src/include/gnunet_client_lib.h
index 2ba9e135f..3773a55d1 100644
--- a/src/include/gnunet_client_lib.h
+++ b/src/include/gnunet_client_lib.h
@@ -179,7 +179,10 @@ GNUNET_CLIENT_transmit_and_get_response (struct GNUNET_CLIENT_Connection *sock,
179 179
180/** 180/**
181 * Request that the service should shutdown. 181 * Request that the service should shutdown.
182 * Afterwards, the connection should be disconnected. 182 * Afterwards, the connection will automatically be
183 * disconnected. Hence the "sock" shoud not
184 * be used by the caller after this call
185 * (calling this function frees "sock" after a while).
183 * 186 *
184 * @param sock the socket connected to the service 187 * @param sock the socket connected to the service
185 */ 188 */
diff --git a/src/testing/test_testing.c b/src/testing/test_testing.c
index 886427402..f56ebe2c0 100644
--- a/src/testing/test_testing.c
+++ b/src/testing/test_testing.c
@@ -24,7 +24,7 @@
24#include "platform.h" 24#include "platform.h"
25#include "gnunet_testing_lib.h" 25#include "gnunet_testing_lib.h"
26 26
27#define VERBOSE GNUNET_YES 27#define VERBOSE GNUNET_NO
28 28
29static int ok; 29static int ok;
30 30
@@ -48,7 +48,8 @@ static void my_cb(void *cls,
48 GNUNET_assert (id != NULL); 48 GNUNET_assert (id != NULL);
49#if VERBOSE 49#if VERBOSE
50 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 50 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
51 "Daemon started, will now stop it.\n"); 51 "Daemon `%s' started, will now stop it.\n",
52 GNUNET_i2s (id));
52#endif 53#endif
53 GNUNET_TESTING_daemon_stop (d, &end_cb, NULL); 54 GNUNET_TESTING_daemon_stop (d, &end_cb, NULL);
54} 55}
diff --git a/src/testing/test_testing_data.conf b/src/testing/test_testing_data.conf
index f326e72bd..f314028d4 100644
--- a/src/testing/test_testing_data.conf
+++ b/src/testing/test_testing_data.conf
@@ -8,6 +8,8 @@ PORT = 2564
8[transport] 8[transport]
9PORT = 2565 9PORT = 2565
10PLUGINS = tcp 10PLUGINS = tcp
11#PREFIX = xterm -e xterm -T transport -e gdb -x cmd --args
12#PREFIX = valgrind --tool=memcheck --log-file=logs%p
11 13
12[arm] 14[arm]
13PORT = 2566 15PORT = 2566
diff --git a/src/testing/testing.c b/src/testing/testing.c
index e4cc74827..35a872619 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -40,13 +40,13 @@
40#include "gnunet_testing_lib.h" 40#include "gnunet_testing_lib.h"
41#include "gnunet_transport_service.h" 41#include "gnunet_transport_service.h"
42 42
43#define DEBUG_TESTING GNUNET_YES 43#define DEBUG_TESTING GNUNET_NO
44 44
45/** 45/**
46 * How long do we wait after starting gnunet-service-arm 46 * How long do we wait after starting gnunet-service-arm
47 * for the core service to be alive? 47 * for the core service to be alive?
48 */ 48 */
49#define ARM_START_WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2) 49#define ARM_START_WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
50 50
51/** 51/**
52 * How many times are we willing to try to wait for "scp" or 52 * How many times are we willing to try to wait for "scp" or
@@ -632,8 +632,13 @@ GNUNET_TESTING_daemon_start (struct GNUNET_SCHEDULER_Handle *sched,
632 ret->username = username; 632 ret->username = username;
633 633
634 /* 2) copy file to remote host */ 634 /* 2) copy file to remote host */
635 if (NULL != hostname) 635 if (NULL != hostname)
636 { 636 {
637#if DEBUG_TESTING
638 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
639 "Copying configuration file to host `%s'.\n",
640 hostname);
641#endif
637 ret->phase = SP_COPYING; 642 ret->phase = SP_COPYING;
638 if (NULL != username) 643 if (NULL != username)
639 GNUNET_asprintf (&arg, 644 GNUNET_asprintf (&arg,
@@ -732,7 +737,6 @@ void GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d,
732 "arm", 737 "arm",
733 d->cfg); 738 d->cfg);
734 GNUNET_CLIENT_service_shutdown (cc); 739 GNUNET_CLIENT_service_shutdown (cc);
735 GNUNET_CLIENT_disconnect (cc);
736 740
737 /* state clean up and notifications */ 741 /* state clean up and notifications */
738 if (0 != UNLINK (d->cfgfile)) 742 if (0 != UNLINK (d->cfgfile))
@@ -741,6 +745,11 @@ void GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d,
741 d->cfgfile); 745 d->cfgfile);
742 if (d->hostname != NULL) 746 if (d->hostname != NULL)
743 { 747 {
748#if DEBUG_TESTING
749 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
750 "Removing configuration file on remote host `%s'.\n",
751 d->hostname);
752#endif
744 if (NULL != d->username) 753 if (NULL != d->username)
745 GNUNET_asprintf (&dst, 754 GNUNET_asprintf (&dst,
746 "%s@%s", 755 "%s@%s",
@@ -832,6 +841,11 @@ void GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d,
832 cb (cb_cls, NULL); 841 cb (cb_cls, NULL);
833 return; 842 return;
834 } 843 }
844#if DEBUG_TESTING
845 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
846 "Copying updated configuration file to remote host `%s'.\n",
847 d->hostname);
848#endif
835 d->phase = SP_CONFIG_UPDATE; 849 d->phase = SP_CONFIG_UPDATE;
836 if (NULL != d->username) 850 if (NULL != d->username)
837 GNUNET_asprintf (&arg, 851 GNUNET_asprintf (&arg,
@@ -873,28 +887,30 @@ void GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d,
873 d); 887 d);
874} 888}
875 889
890
876/** 891/**
877 * FIXME. 892 * Data kept for each pair of peers that we try
893 * to connect.
878 */ 894 */
879struct ConnectContext 895struct ConnectContext
880{ 896{
881 /** 897 /**
882 * FIXME. 898 * Testing handle to the first daemon.
883 */ 899 */
884 struct GNUNET_TESTING_Daemon *d1; 900 struct GNUNET_TESTING_Daemon *d1;
885 901
886 /** 902 /**
887 * FIXME. 903 * Testing handle to the second daemon.
888 */ 904 */
889 struct GNUNET_TESTING_Daemon *d2; 905 struct GNUNET_TESTING_Daemon *d2;
890 906
891 /** 907 /**
892 * FIXME. 908 * Transport handle to the first daemon.
893 */ 909 */
894 struct GNUNET_TRANSPORT_Handle *d1th; 910 struct GNUNET_TRANSPORT_Handle *d1th;
895 911
896 /** 912 /**
897 * FIXME. 913 * Transport handle to the second daemon.
898 */ 914 */
899 struct GNUNET_TRANSPORT_Handle *d2th; 915 struct GNUNET_TRANSPORT_Handle *d2th;
900 916
@@ -919,7 +935,7 @@ struct ConnectContext
919/** 935/**
920 * Success, connection is up. Signal client our success. 936 * Success, connection is up. Signal client our success.
921 * 937 *
922 * @param cls FIXME 938 * @param cls our "struct ConnectContext"
923 * @param size number of bytes available in buf 939 * @param size number of bytes available in buf
924 * @param buf where to copy the message, NULL on error 940 * @param buf where to copy the message, NULL on error
925 * @return number of bytes copied to buf 941 * @return number of bytes copied to buf
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 6803e3179..0dc3f859d 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -2588,6 +2588,42 @@ client_disconnect_notification (void *cls,
2588 2588
2589 2589
2590/** 2590/**
2591 * Function called when the service shuts down. Unloads our plugins.
2592 *
2593 * @param cls closure, unused
2594 * @param tc task context (unused)
2595 */
2596static void
2597unload_plugins (void *cls,
2598 const struct GNUNET_SCHEDULER_TaskContext *tc)
2599{
2600 struct TransportPlugin *plug;
2601 struct AddressList *al;
2602
2603#if DEBUG_TRANSPORT
2604 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2605 "Transport service is unloading plugins...\n");
2606#endif
2607 while (NULL != (plug = plugins))
2608 {
2609 plugins = plug->next;
2610 GNUNET_break (NULL == GNUNET_PLUGIN_unload (plug->lib_name, plug->api));
2611 GNUNET_free (plug->lib_name);
2612 GNUNET_free (plug->short_name);
2613 while (NULL != (al = plug->addresses))
2614 {
2615 plug->addresses = al->next;
2616 GNUNET_free (al);
2617 }
2618 GNUNET_free (plug);
2619 }
2620 if (my_private_key != NULL)
2621 GNUNET_CRYPTO_rsa_key_free (my_private_key);
2622 GNUNET_free_non_null (our_hello);
2623}
2624
2625
2626/**
2591 * Initiate transport service. 2627 * Initiate transport service.
2592 * 2628 *
2593 * @param cls closure 2629 * @param cls closure
@@ -2661,6 +2697,12 @@ run (void *cls,
2661 } 2697 }
2662 GNUNET_free (plugs); 2698 GNUNET_free (plugs);
2663 } 2699 }
2700 GNUNET_SCHEDULER_add_delayed (sched,
2701 GNUNET_YES,
2702 GNUNET_SCHEDULER_PRIORITY_IDLE,
2703 GNUNET_SCHEDULER_NO_TASK,
2704 GNUNET_TIME_UNIT_FOREVER_REL,
2705 &unload_plugins, NULL);
2664 if (no_transports) 2706 if (no_transports)
2665 refresh_hello (); 2707 refresh_hello ();
2666#if DEBUG_TRANSPORT 2708#if DEBUG_TRANSPORT
@@ -2673,43 +2715,6 @@ run (void *cls,
2673 2715
2674 2716
2675/** 2717/**
2676 * Function called when the service shuts
2677 * down. Unloads our plugins.
2678 *
2679 * @param cls closure
2680 * @param cfg configuration to use
2681 */
2682static void
2683unload_plugins (void *cls,
2684 const struct GNUNET_CONFIGURATION_Handle *cfg)
2685{
2686 struct TransportPlugin *plug;
2687 struct AddressList *al;
2688
2689#if DEBUG_TRANSPORT
2690 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2691 "Transport service is unloading plugins...\n");
2692#endif
2693 while (NULL != (plug = plugins))
2694 {
2695 plugins = plug->next;
2696 GNUNET_break (NULL == GNUNET_PLUGIN_unload (plug->lib_name, plug->api));
2697 GNUNET_free (plug->lib_name);
2698 GNUNET_free (plug->short_name);
2699 while (NULL != (al = plug->addresses))
2700 {
2701 plug->addresses = al->next;
2702 GNUNET_free (al);
2703 }
2704 GNUNET_free (plug);
2705 }
2706 if (my_private_key != NULL)
2707 GNUNET_CRYPTO_rsa_key_free (my_private_key);
2708 GNUNET_free_non_null (our_hello);
2709}
2710
2711
2712/**
2713 * The main function for the transport service. 2718 * The main function for the transport service.
2714 * 2719 *
2715 * @param argc number of arguments from the command line 2720 * @param argc number of arguments from the command line
@@ -2723,7 +2728,7 @@ main (int argc, char *const *argv)
2723 GNUNET_SERVICE_run (argc, 2728 GNUNET_SERVICE_run (argc,
2724 argv, 2729 argv,
2725 "transport", 2730 "transport",
2726 &run, NULL, &unload_plugins, NULL)) ? 0 : 1; 2731 &run, NULL, NULL, NULL)) ? 0 : 1;
2727} 2732}
2728 2733
2729/* end of gnunet-service-transport.c */ 2734/* end of gnunet-service-transport.c */
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 65abf5fa4..eeb333a53 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -2016,7 +2016,10 @@ process_hostname_ips (void *cls,
2016 struct Plugin *plugin = cls; 2016 struct Plugin *plugin = cls;
2017 2017
2018 if (addr == NULL) 2018 if (addr == NULL)
2019 return; 2019 {
2020 hostname_dns = NULL;
2021 return;
2022 }
2020 process_interfaces (plugin, 2023 process_interfaces (plugin,
2021 "<hostname>", 2024 "<hostname>",
2022 GNUNET_YES, 2025 GNUNET_YES,
diff --git a/src/util/client.c b/src/util/client.c
index 8c429995c..3c6f0c405 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -468,13 +468,28 @@ GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *sock,
468} 468}
469 469
470 470
471/**
472 * If possible, write a shutdown message to the target
473 * buffer and destroy the client connection.
474 *
475 * @param cls the "struct GNUNET_CLIENT_Connection" to destroy
476 * @param size number of bytes available in buf
477 * @param buf NULL on error, otherwise target buffer
478 * @return number of bytes written to buf
479 */
471static size_t 480static size_t
472write_shutdown (void *cls, size_t size, void *buf) 481write_shutdown (void *cls, size_t size, void *buf)
473{ 482{
474 struct GNUNET_MessageHeader *msg; 483 struct GNUNET_MessageHeader *msg;
484 struct GNUNET_CLIENT_Connection *sock = cls;
475 485
486 GNUNET_CLIENT_disconnect (sock);
476 if (size < sizeof (struct GNUNET_MessageHeader)) 487 if (size < sizeof (struct GNUNET_MessageHeader))
477 return 0; /* client disconnected */ 488 {
489 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
490 _("Failed to transmit shutdown request to client.\n"));
491 return 0; /* client disconnected */
492 }
478 msg = (struct GNUNET_MessageHeader *) buf; 493 msg = (struct GNUNET_MessageHeader *) buf;
479 msg->type = htons (GNUNET_MESSAGE_TYPE_SHUTDOWN); 494 msg->type = htons (GNUNET_MESSAGE_TYPE_SHUTDOWN);
480 msg->size = htons (sizeof (struct GNUNET_MessageHeader)); 495 msg->size = htons (sizeof (struct GNUNET_MessageHeader));
@@ -492,9 +507,9 @@ void
492GNUNET_CLIENT_service_shutdown (struct GNUNET_CLIENT_Connection *sock) 507GNUNET_CLIENT_service_shutdown (struct GNUNET_CLIENT_Connection *sock)
493{ 508{
494 GNUNET_CONNECTION_notify_transmit_ready (sock->sock, 509 GNUNET_CONNECTION_notify_transmit_ready (sock->sock,
495 sizeof (struct GNUNET_MessageHeader), 510 sizeof (struct GNUNET_MessageHeader),
496 GNUNET_TIME_UNIT_FOREVER_REL, 511 GNUNET_TIME_UNIT_FOREVER_REL,
497 &write_shutdown, NULL); 512 &write_shutdown, sock);
498} 513}
499 514
500 515
diff --git a/src/util/test_service.c b/src/util/test_service.c
index f615e7eb4..037f6edf7 100644
--- a/src/util/test_service.c
+++ b/src/util/test_service.c
@@ -47,7 +47,6 @@ end_it (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
47 47
48 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down service\n"); 48 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down service\n");
49 GNUNET_CLIENT_service_shutdown (client); 49 GNUNET_CLIENT_service_shutdown (client);
50 GNUNET_CLIENT_disconnect (client);
51 if (sctx != NULL) 50 if (sctx != NULL)
52 GNUNET_SERVICE_stop (sctx); 51 GNUNET_SERVICE_stop (sctx);
53} 52}