diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-03-06 05:45:34 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-03-06 05:45:34 +0000 |
commit | 5cf995902264fea023a371d66004ae5a52341093 (patch) | |
tree | c519035926d3c4b2eb2d1f303befab006d327dad /src | |
parent | cefb658764d69d55476c614f5f592fdccfcc5d62 (diff) | |
download | gnunet-5cf995902264fea023a371d66004ae5a52341093.tar.gz gnunet-5cf995902264fea023a371d66004ae5a52341093.zip |
-bugfixes and testcases
Diffstat (limited to 'src')
-rw-r--r-- | src/stream/Makefile.am | 12 | ||||
-rw-r--r-- | src/stream/stream_api.c | 46 | ||||
-rw-r--r-- | src/stream/test_stream_api.c | 432 | ||||
-rw-r--r-- | src/stream/test_stream_local.c | 176 | ||||
-rw-r--r-- | src/stream/test_stream_local.conf | 6 |
5 files changed, 590 insertions, 82 deletions
diff --git a/src/stream/Makefile.am b/src/stream/Makefile.am index c2d2ac7f0..45617e481 100644 --- a/src/stream/Makefile.am +++ b/src/stream/Makefile.am | |||
@@ -20,7 +20,8 @@ libgnunetstream_la_LDFLAGS = \ | |||
20 | $(GN_LIB_LDFLAGS) | 20 | $(GN_LIB_LDFLAGS) |
21 | 21 | ||
22 | check_PROGRAMS = \ | 22 | check_PROGRAMS = \ |
23 | test_stream_local | 23 | test_stream_local \ |
24 | test_stream_api | ||
24 | # test_stream_halfclose | 25 | # test_stream_halfclose |
25 | 26 | ||
26 | EXTRA_DIST = test_stream_local.conf | 27 | EXTRA_DIST = test_stream_local.conf |
@@ -34,7 +35,14 @@ test_stream_local_SOURCES = \ | |||
34 | test_stream_local_LDADD = \ | 35 | test_stream_local_LDADD = \ |
35 | $(top_builddir)/src/stream/libgnunetstream.la \ | 36 | $(top_builddir)/src/stream/libgnunetstream.la \ |
36 | $(top_builddir)/src/util/libgnunetutil.la \ | 37 | $(top_builddir)/src/util/libgnunetutil.la \ |
37 | $(top_builddir)/src/testing/libgnunettesting.la | 38 | $(top_builddir)/src/testing/libgnunettesting.la |
39 | |||
40 | test_stream_api_SOURCES = \ | ||
41 | test_stream_api.c | ||
42 | test_stream_api_LDADD = \ | ||
43 | $(top_builddir)/src/stream/libgnunetstream.la \ | ||
44 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
45 | $(top_builddir)/src/testing/libgnunettesting.la | ||
38 | 46 | ||
39 | #test_stream_halfclose_SOURCES = \ | 47 | #test_stream_halfclose_SOURCES = \ |
40 | # test_stream_halfclose.c | 48 | # test_stream_halfclose.c |
diff --git a/src/stream/stream_api.c b/src/stream/stream_api.c index 58f180c4d..245213c5c 100644 --- a/src/stream/stream_api.c +++ b/src/stream/stream_api.c | |||
@@ -19,6 +19,8 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* TODO: | 21 | /* TODO: |
22 | * Copy MESH handle from lsocket to socket | ||
23 | * | ||
22 | * Checks for matching the sender and socket->other_peer in server | 24 | * Checks for matching the sender and socket->other_peer in server |
23 | * message handlers */ | 25 | * message handlers */ |
24 | 26 | ||
@@ -434,7 +436,7 @@ send_message_notify (void *cls, size_t size, void *buf) | |||
434 | memcpy (buf, head->message, ret); | 436 | memcpy (buf, head->message, ret); |
435 | if (NULL != head->finish_cb) | 437 | if (NULL != head->finish_cb) |
436 | { | 438 | { |
437 | head->finish_cb (socket, head->finish_cb_cls); | 439 | head->finish_cb (head->finish_cb_cls, socket); |
438 | } | 440 | } |
439 | GNUNET_CONTAINER_DLL_remove (socket->queue_head, | 441 | GNUNET_CONTAINER_DLL_remove (socket->queue_head, |
440 | socket->queue_tail, | 442 | socket->queue_tail, |
@@ -476,6 +478,10 @@ queue_message (struct GNUNET_STREAM_Socket *socket, | |||
476 | { | 478 | { |
477 | struct MessageQueue *queue_entity; | 479 | struct MessageQueue *queue_entity; |
478 | 480 | ||
481 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
482 | "Queueing message of type %d and size %d\n", | ||
483 | ntohs (message->header.type), | ||
484 | ntohs (message->header.size)); | ||
479 | queue_entity = GNUNET_malloc (sizeof (struct MessageQueue)); | 485 | queue_entity = GNUNET_malloc (sizeof (struct MessageQueue)); |
480 | queue_entity->message = message; | 486 | queue_entity->message = message; |
481 | queue_entity->finish_cb = finish_cb; | 487 | queue_entity->finish_cb = finish_cb; |
@@ -959,6 +965,8 @@ set_state_established (void *cls, | |||
959 | socket->write_offset = 0; | 965 | socket->write_offset = 0; |
960 | socket->read_offset = 0; | 966 | socket->read_offset = 0; |
961 | socket->state = STATE_ESTABLISHED; | 967 | socket->state = STATE_ESTABLISHED; |
968 | if (socket->open_cb) | ||
969 | socket->open_cb (socket->open_cls, socket); | ||
962 | } | 970 | } |
963 | 971 | ||
964 | 972 | ||
@@ -1324,6 +1332,8 @@ server_handle_hello (void *cls, | |||
1324 | struct GNUNET_STREAM_HelloAckMessage *reply; | 1332 | struct GNUNET_STREAM_HelloAckMessage *reply; |
1325 | 1333 | ||
1326 | GNUNET_assert (socket->tunnel == tunnel); | 1334 | GNUNET_assert (socket->tunnel == tunnel); |
1335 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1336 | "Received HELLO from %s\n", GNUNET_i2s(sender)); | ||
1327 | 1337 | ||
1328 | /* Catch possible protocol breaks */ | 1338 | /* Catch possible protocol breaks */ |
1329 | GNUNET_break_op (0 != memcmp (&socket->other_peer, | 1339 | GNUNET_break_op (0 != memcmp (&socket->other_peer, |
@@ -1786,10 +1796,6 @@ mesh_peer_connect_callback (void *cls, | |||
1786 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1796 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1787 | "STREAM_open callback is NULL\n"); | 1797 | "STREAM_open callback is NULL\n"); |
1788 | } | 1798 | } |
1789 | else | ||
1790 | { | ||
1791 | socket->open_cb (socket->open_cls, socket); | ||
1792 | } | ||
1793 | } | 1799 | } |
1794 | 1800 | ||
1795 | 1801 | ||
@@ -1826,11 +1832,14 @@ new_tunnel_notify (void *cls, | |||
1826 | struct GNUNET_STREAM_ListenSocket *lsocket = cls; | 1832 | struct GNUNET_STREAM_ListenSocket *lsocket = cls; |
1827 | struct GNUNET_STREAM_Socket *socket; | 1833 | struct GNUNET_STREAM_Socket *socket; |
1828 | 1834 | ||
1835 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1836 | "Peer %s initiated tunnel to us\n", GNUNET_i2s (initiator)); | ||
1829 | socket = GNUNET_malloc (sizeof (struct GNUNET_STREAM_Socket)); | 1837 | socket = GNUNET_malloc (sizeof (struct GNUNET_STREAM_Socket)); |
1830 | socket->tunnel = tunnel; | 1838 | socket->tunnel = tunnel; |
1831 | socket->session_id = 0; /* FIXME */ | 1839 | socket->session_id = 0; /* FIXME */ |
1832 | socket->other_peer = *initiator; | 1840 | socket->other_peer = *initiator; |
1833 | socket->state = STATE_INIT; | 1841 | socket->state = STATE_INIT; |
1842 | /* FIXME: Copy MESH handle from lsocket to socket */ | ||
1834 | 1843 | ||
1835 | if (GNUNET_SYSERR == lsocket->listen_cb (lsocket->listen_cb_cls, | 1844 | if (GNUNET_SYSERR == lsocket->listen_cb (lsocket->listen_cb_cls, |
1836 | socket, | 1845 | socket, |
@@ -1908,7 +1917,9 @@ GNUNET_STREAM_open (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1908 | struct GNUNET_STREAM_Socket *socket; | 1917 | struct GNUNET_STREAM_Socket *socket; |
1909 | enum GNUNET_STREAM_Option option; | 1918 | enum GNUNET_STREAM_Option option; |
1910 | va_list vargs; /* Variable arguments */ | 1919 | va_list vargs; /* Variable arguments */ |
1911 | GNUNET_MESH_ApplicationType no_port; | 1920 | |
1921 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1922 | "%s\n", __func__); | ||
1912 | 1923 | ||
1913 | socket = GNUNET_malloc (sizeof (struct GNUNET_STREAM_Socket)); | 1924 | socket = GNUNET_malloc (sizeof (struct GNUNET_STREAM_Socket)); |
1914 | socket->other_peer = *target; | 1925 | socket->other_peer = *target; |
@@ -1934,14 +1945,13 @@ GNUNET_STREAM_open (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1934 | } | 1945 | } |
1935 | } while (GNUNET_STREAM_OPTION_END != option); | 1946 | } while (GNUNET_STREAM_OPTION_END != option); |
1936 | va_end (vargs); /* End of variable args parsing */ | 1947 | va_end (vargs); /* End of variable args parsing */ |
1937 | no_port = 0; | ||
1938 | socket->mesh = GNUNET_MESH_connect (cfg, /* the configuration handle */ | 1948 | socket->mesh = GNUNET_MESH_connect (cfg, /* the configuration handle */ |
1939 | 1, /* QUEUE size as parameter? */ | 1949 | 10, /* QUEUE size as parameter? */ |
1940 | socket, /* cls */ | 1950 | socket, /* cls */ |
1941 | NULL, /* No inbound tunnel handler */ | 1951 | NULL, /* No inbound tunnel handler */ |
1942 | NULL, /* No inbound tunnel cleaner */ | 1952 | &tunnel_cleaner, |
1943 | client_message_handlers, | 1953 | client_message_handlers, |
1944 | &no_port); /* We don't get inbound tunnels */ | 1954 | &app_port); /* We don't get inbound tunnels */ |
1945 | if (NULL == socket->mesh) /* Fail if we cannot connect to mesh */ | 1955 | if (NULL == socket->mesh) /* Fail if we cannot connect to mesh */ |
1946 | { | 1956 | { |
1947 | GNUNET_free (socket); | 1957 | GNUNET_free (socket); |
@@ -1949,13 +1959,19 @@ GNUNET_STREAM_open (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1949 | } | 1959 | } |
1950 | 1960 | ||
1951 | /* Now create the mesh tunnel to target */ | 1961 | /* Now create the mesh tunnel to target */ |
1962 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1963 | "Creating MESH Tunnel\n"); | ||
1952 | socket->tunnel = GNUNET_MESH_tunnel_create (socket->mesh, | 1964 | socket->tunnel = GNUNET_MESH_tunnel_create (socket->mesh, |
1953 | NULL, /* Tunnel context */ | 1965 | NULL, /* Tunnel context */ |
1954 | &mesh_peer_connect_callback, | 1966 | &mesh_peer_connect_callback, |
1955 | &mesh_peer_disconnect_callback, | 1967 | &mesh_peer_disconnect_callback, |
1956 | socket); | 1968 | socket); |
1957 | // FIXME: if (NULL == socket->tunnel) ... | 1969 | GNUNET_assert (NULL != socket->tunnel); |
1958 | 1970 | GNUNET_MESH_peer_request_connect_add (socket->tunnel, | |
1971 | target); | ||
1972 | |||
1973 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1974 | "%s() END\n", __func__); | ||
1959 | return socket; | 1975 | return socket; |
1960 | } | 1976 | } |
1961 | 1977 | ||
@@ -2050,10 +2066,7 @@ GNUNET_STREAM_listen (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
2050 | { | 2066 | { |
2051 | /* FIXME: Add variable args for passing configration options? */ | 2067 | /* FIXME: Add variable args for passing configration options? */ |
2052 | struct GNUNET_STREAM_ListenSocket *lsocket; | 2068 | struct GNUNET_STREAM_ListenSocket *lsocket; |
2053 | GNUNET_MESH_ApplicationType app_types[2]; | ||
2054 | 2069 | ||
2055 | app_types[0] = app_port; | ||
2056 | app_types[1] = 0; | ||
2057 | lsocket = GNUNET_malloc (sizeof (struct GNUNET_STREAM_ListenSocket)); | 2070 | lsocket = GNUNET_malloc (sizeof (struct GNUNET_STREAM_ListenSocket)); |
2058 | lsocket->port = app_port; | 2071 | lsocket->port = app_port; |
2059 | lsocket->listen_cb = listen_cb; | 2072 | lsocket->listen_cb = listen_cb; |
@@ -2064,7 +2077,8 @@ GNUNET_STREAM_listen (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
2064 | &new_tunnel_notify, | 2077 | &new_tunnel_notify, |
2065 | &tunnel_cleaner, | 2078 | &tunnel_cleaner, |
2066 | server_message_handlers, | 2079 | server_message_handlers, |
2067 | app_types); | 2080 | &app_port); |
2081 | GNUNET_assert (NULL != lsocket->mesh); | ||
2068 | return lsocket; | 2082 | return lsocket; |
2069 | } | 2083 | } |
2070 | 2084 | ||
diff --git a/src/stream/test_stream_api.c b/src/stream/test_stream_api.c new file mode 100644 index 000000000..2eeedeec5 --- /dev/null +++ b/src/stream/test_stream_api.c | |||
@@ -0,0 +1,432 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2011, 2012 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file stream/test_stream_local.c | ||
23 | * @brief Stream API testing between local peers | ||
24 | * @author Sree Harsha Totakura | ||
25 | */ | ||
26 | |||
27 | #include <string.h> | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_util_lib.h" | ||
31 | #include "gnunet_mesh_service.h" | ||
32 | #include "gnunet_stream_lib.h" | ||
33 | #include "gnunet_testing_lib.h" | ||
34 | |||
35 | #define VERBOSE 1 | ||
36 | |||
37 | /** | ||
38 | * Structure for holding peer's sockets and IO Handles | ||
39 | */ | ||
40 | struct PeerData | ||
41 | { | ||
42 | /** | ||
43 | * Peer's stream socket | ||
44 | */ | ||
45 | struct GNUNET_STREAM_Socket *socket; | ||
46 | |||
47 | /** | ||
48 | * Peer's io write handle | ||
49 | */ | ||
50 | struct GNUNET_STREAM_IOWriteHandle *io_write_handle; | ||
51 | |||
52 | /** | ||
53 | * Peer's io read handle | ||
54 | */ | ||
55 | struct GNUNET_STREAM_IOReadHandle *io_read_handle; | ||
56 | |||
57 | /** | ||
58 | * Bytes the peer has written | ||
59 | */ | ||
60 | unsigned int bytes_wrote; | ||
61 | |||
62 | /** | ||
63 | * Byte the peer has read | ||
64 | */ | ||
65 | unsigned int bytes_read; | ||
66 | }; | ||
67 | |||
68 | static struct GNUNET_OS_Process *arm_pid; | ||
69 | static struct PeerData peer1; | ||
70 | static struct PeerData peer2; | ||
71 | static struct GNUNET_STREAM_ListenSocket *peer2_listen_socket; | ||
72 | static struct GNUNET_CONFIGURATION_Handle *config; | ||
73 | |||
74 | static GNUNET_SCHEDULER_TaskIdentifier abort_task; | ||
75 | static GNUNET_SCHEDULER_TaskIdentifier test_task; | ||
76 | static GNUNET_SCHEDULER_TaskIdentifier read_task; | ||
77 | |||
78 | static char *data = "ABCD"; | ||
79 | static int result; | ||
80 | |||
81 | /** | ||
82 | * Shutdown nicely | ||
83 | */ | ||
84 | static void | ||
85 | do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
86 | { | ||
87 | GNUNET_STREAM_close (peer1.socket); | ||
88 | if (NULL != peer2.socket) | ||
89 | GNUNET_STREAM_close (peer2.socket); | ||
90 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: shutdown\n"); | ||
91 | if (0 != abort_task) | ||
92 | { | ||
93 | GNUNET_SCHEDULER_cancel (abort_task); | ||
94 | } | ||
95 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: arm\n"); | ||
96 | if (0 != GNUNET_OS_process_kill (arm_pid, SIGTERM)) | ||
97 | { | ||
98 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | ||
99 | } | ||
100 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Wait\n"); | ||
101 | /* Free the duplicated configuration */ | ||
102 | GNUNET_CONFIGURATION_destroy (config); | ||
103 | GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (arm_pid)); | ||
104 | GNUNET_OS_process_close (arm_pid); | ||
105 | } | ||
106 | |||
107 | |||
108 | /** | ||
109 | * Something went wrong and timed out. Kill everything and set error flag | ||
110 | */ | ||
111 | static void | ||
112 | do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
113 | { | ||
114 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: ABORT\n"); | ||
115 | if (0 != test_task) | ||
116 | { | ||
117 | GNUNET_SCHEDULER_cancel (test_task); | ||
118 | } | ||
119 | if (0 != read_task) | ||
120 | { | ||
121 | GNUNET_SCHEDULER_cancel (read_task); | ||
122 | } | ||
123 | result = GNUNET_SYSERR; | ||
124 | abort_task = 0; | ||
125 | do_shutdown (cls, tc); | ||
126 | } | ||
127 | |||
128 | /** | ||
129 | * Signature for input processor | ||
130 | * | ||
131 | * @param cls the closure from GNUNET_STREAM_write/read | ||
132 | * @param status the status of the stream at the time this function is called | ||
133 | * @param data traffic from the other side | ||
134 | * @param size the number of bytes available in data read | ||
135 | * @return number of bytes of processed from 'data' (any data remaining should be | ||
136 | * given to the next time the read processor is called). | ||
137 | */ | ||
138 | static size_t | ||
139 | input_processor (void *cls, | ||
140 | enum GNUNET_STREAM_Status status, | ||
141 | const void *input_data, | ||
142 | size_t size); | ||
143 | |||
144 | |||
145 | /** | ||
146 | * The write completion function; called upon writing some data to stream or | ||
147 | * upon error | ||
148 | * | ||
149 | * @param cls the closure from GNUNET_STREAM_write/read | ||
150 | * @param status the status of the stream at the time this function is called | ||
151 | * @param size the number of bytes read or written | ||
152 | */ | ||
153 | static void | ||
154 | write_completion (void *cls, | ||
155 | enum GNUNET_STREAM_Status status, | ||
156 | size_t size) | ||
157 | { | ||
158 | struct PeerData *peer; | ||
159 | |||
160 | peer = (struct PeerData *) cls; | ||
161 | GNUNET_assert (GNUNET_STREAM_OK == status); | ||
162 | GNUNET_assert (size < strlen (data)); | ||
163 | peer->bytes_wrote += size; | ||
164 | |||
165 | if (peer->bytes_wrote < strlen(data)) /* Have more data to send */ | ||
166 | { | ||
167 | peer->io_write_handle = | ||
168 | GNUNET_STREAM_write (peer->socket, | ||
169 | (void *) data, | ||
170 | strlen(data) - peer->bytes_wrote, | ||
171 | GNUNET_TIME_relative_multiply | ||
172 | (GNUNET_TIME_UNIT_SECONDS, 5), | ||
173 | &write_completion, | ||
174 | cls); | ||
175 | GNUNET_assert (NULL != peer->io_write_handle); | ||
176 | } | ||
177 | else | ||
178 | { | ||
179 | if (&peer1 == peer) /* Peer1 has finished writing; should read now */ | ||
180 | { | ||
181 | peer->io_read_handle = | ||
182 | GNUNET_STREAM_read ((struct GNUNET_STREAM_Socket *) | ||
183 | peer->socket, | ||
184 | GNUNET_TIME_relative_multiply | ||
185 | (GNUNET_TIME_UNIT_SECONDS, 5), | ||
186 | &input_processor, | ||
187 | cls); | ||
188 | GNUNET_assert (NULL!=peer->io_read_handle); | ||
189 | } | ||
190 | } | ||
191 | } | ||
192 | |||
193 | |||
194 | /** | ||
195 | * Function executed after stream has been established | ||
196 | * | ||
197 | * @param cls the closure from GNUNET_STREAM_open | ||
198 | * @param socket socket to use to communicate with the other side (read/write) | ||
199 | */ | ||
200 | static void | ||
201 | stream_open_cb (void *cls, | ||
202 | struct GNUNET_STREAM_Socket *socket) | ||
203 | { | ||
204 | struct PeerData *peer; | ||
205 | |||
206 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stream established from peer1\n"); | ||
207 | peer = (struct PeerData *) cls; | ||
208 | peer->bytes_wrote = 0; | ||
209 | GNUNET_assert (socket == peer1.socket); | ||
210 | GNUNET_assert (socket == peer->socket); | ||
211 | peer->io_write_handle = GNUNET_STREAM_write (peer->socket, /* socket */ | ||
212 | (void *) data, /* data */ | ||
213 | strlen(data), | ||
214 | GNUNET_TIME_relative_multiply | ||
215 | (GNUNET_TIME_UNIT_SECONDS, 5), | ||
216 | &write_completion, | ||
217 | cls); | ||
218 | GNUNET_assert (NULL != peer->io_write_handle); | ||
219 | } | ||
220 | |||
221 | |||
222 | /** | ||
223 | * Input processor | ||
224 | * | ||
225 | * @param cls the closure from GNUNET_STREAM_write/read | ||
226 | * @param status the status of the stream at the time this function is called | ||
227 | * @param data traffic from the other side | ||
228 | * @param size the number of bytes available in data read | ||
229 | * @return number of bytes of processed from 'data' (any data remaining should be | ||
230 | * given to the next time the read processor is called). | ||
231 | */ | ||
232 | static size_t | ||
233 | input_processor (void *cls, | ||
234 | enum GNUNET_STREAM_Status status, | ||
235 | const void *input_data, | ||
236 | size_t size) | ||
237 | { | ||
238 | struct PeerData *peer; | ||
239 | |||
240 | peer = (struct PeerData *) cls; | ||
241 | |||
242 | GNUNET_assert (GNUNET_STREAM_OK == status); | ||
243 | GNUNET_assert (size < strlen (data)); | ||
244 | GNUNET_assert (strncmp ((const char *) data + peer->bytes_read, | ||
245 | (const char *) input_data, | ||
246 | size)); | ||
247 | peer->bytes_read += size; | ||
248 | |||
249 | if (peer->bytes_read < strlen (data)) | ||
250 | { | ||
251 | peer->io_read_handle = GNUNET_STREAM_read ((struct GNUNET_STREAM_Socket *) | ||
252 | peer->socket, | ||
253 | GNUNET_TIME_relative_multiply | ||
254 | (GNUNET_TIME_UNIT_SECONDS, 5), | ||
255 | &input_processor, | ||
256 | cls); | ||
257 | GNUNET_assert (NULL != peer->io_read_handle); | ||
258 | } | ||
259 | else | ||
260 | { | ||
261 | if (&peer2 == peer) /* Peer2 has completed reading; should write */ | ||
262 | { | ||
263 | peer->bytes_wrote = 0; | ||
264 | peer->io_write_handle = | ||
265 | GNUNET_STREAM_write ((struct GNUNET_STREAM_Socket *) | ||
266 | peer->socket, | ||
267 | (void *) data, | ||
268 | strlen(data), | ||
269 | GNUNET_TIME_relative_multiply | ||
270 | (GNUNET_TIME_UNIT_SECONDS, 5), | ||
271 | &write_completion, | ||
272 | cls); | ||
273 | } | ||
274 | else /* Peer1 has completed reading. End of tests */ | ||
275 | { | ||
276 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | ||
277 | } | ||
278 | } | ||
279 | return size; | ||
280 | } | ||
281 | |||
282 | |||
283 | /** | ||
284 | * Scheduler call back; to be executed when a new stream is connected | ||
285 | * Called from listen connect for peer2 | ||
286 | */ | ||
287 | static void | ||
288 | stream_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
289 | { | ||
290 | read_task = GNUNET_SCHEDULER_NO_TASK; | ||
291 | GNUNET_assert (NULL != cls); | ||
292 | peer2.bytes_read = 0; | ||
293 | GNUNET_STREAM_listen_close (peer2_listen_socket); /* Close listen socket */ | ||
294 | peer2.io_read_handle = | ||
295 | GNUNET_STREAM_read ((struct GNUNET_STREAM_Socket *) cls, | ||
296 | GNUNET_TIME_relative_multiply | ||
297 | (GNUNET_TIME_UNIT_SECONDS, 5), | ||
298 | &input_processor, | ||
299 | (void *) &peer2); | ||
300 | GNUNET_assert (NULL != peer2.io_read_handle); | ||
301 | } | ||
302 | |||
303 | |||
304 | /** | ||
305 | * Functions of this type are called upon new stream connection from other peers | ||
306 | * | ||
307 | * @param cls the closure from GNUNET_STREAM_listen | ||
308 | * @param socket the socket representing the stream | ||
309 | * @param initiator the identity of the peer who wants to establish a stream | ||
310 | * with us | ||
311 | * @return GNUNET_OK to keep the socket open, GNUNET_SYSERR to close the | ||
312 | * stream (the socket will be invalid after the call) | ||
313 | */ | ||
314 | static int | ||
315 | stream_listen_cb (void *cls, | ||
316 | struct GNUNET_STREAM_Socket *socket, | ||
317 | const struct GNUNET_PeerIdentity *initiator) | ||
318 | { | ||
319 | GNUNET_assert (NULL != socket); | ||
320 | GNUNET_assert (NULL == initiator); /* Local peer=NULL? */ | ||
321 | GNUNET_assert (socket != peer1.socket); | ||
322 | |||
323 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
324 | "Peer connected: %s\n", GNUNET_i2s(initiator)); | ||
325 | |||
326 | peer2.socket = socket; | ||
327 | read_task = GNUNET_SCHEDULER_add_now (&stream_read, (void *) socket); | ||
328 | return GNUNET_OK; | ||
329 | } | ||
330 | |||
331 | |||
332 | /** | ||
333 | * Testing function | ||
334 | * | ||
335 | * @param cls NULL | ||
336 | * @param tc the task context | ||
337 | */ | ||
338 | static void | ||
339 | test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
340 | { | ||
341 | struct GNUNET_PeerIdentity self; | ||
342 | |||
343 | test_task = GNUNET_SCHEDULER_NO_TASK; | ||
344 | /* Get our identity */ | ||
345 | GNUNET_assert (GNUNET_OK == GNUNET_TESTING_get_peer_identity (config, | ||
346 | &self)); | ||
347 | |||
348 | peer2_listen_socket = GNUNET_STREAM_listen (config, | ||
349 | 10, /* App port */ | ||
350 | &stream_listen_cb, | ||
351 | NULL); | ||
352 | GNUNET_assert (NULL != peer2_listen_socket); | ||
353 | |||
354 | /* Connect to stream library */ | ||
355 | peer1.socket = GNUNET_STREAM_open (config, | ||
356 | &self, /* Null for local peer? */ | ||
357 | 10, /* App port */ | ||
358 | &stream_open_cb, | ||
359 | (void *) &peer1); | ||
360 | GNUNET_assert (NULL != peer1.socket); | ||
361 | } | ||
362 | |||
363 | /** | ||
364 | * Initialize framework and start test | ||
365 | */ | ||
366 | static void | ||
367 | run (void *cls, char *const *args, const char *cfgfile, | ||
368 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
369 | { | ||
370 | GNUNET_log_setup ("test_stream_local", | ||
371 | #if VERBOSE | ||
372 | "DEBUG", | ||
373 | #else | ||
374 | "WARNING", | ||
375 | #endif | ||
376 | NULL); | ||
377 | /* Duplicate the configuration */ | ||
378 | config = GNUNET_CONFIGURATION_dup (cfg); | ||
379 | arm_pid = | ||
380 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", | ||
381 | "gnunet-service-arm", | ||
382 | #if VERBOSE_ARM | ||
383 | "-L", "DEBUG", | ||
384 | #endif | ||
385 | "-c", "test_stream_local.conf", NULL); | ||
386 | |||
387 | abort_task = | ||
388 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | ||
389 | (GNUNET_TIME_UNIT_SECONDS, 20), &do_abort, | ||
390 | NULL); | ||
391 | |||
392 | test_task = GNUNET_SCHEDULER_add_now (&test, NULL); | ||
393 | |||
394 | } | ||
395 | |||
396 | /** | ||
397 | * Main function | ||
398 | */ | ||
399 | int main (int argc, char **argv) | ||
400 | { | ||
401 | int ret; | ||
402 | |||
403 | char *const argv2[] = { "test-stream-local", | ||
404 | "-c", "test_stream_local.conf", | ||
405 | #if VERBOSE | ||
406 | "-L", "DEBUG", | ||
407 | #endif | ||
408 | NULL | ||
409 | }; | ||
410 | |||
411 | struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
412 | GNUNET_GETOPT_OPTION_END | ||
413 | }; | ||
414 | |||
415 | ret = | ||
416 | GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2, | ||
417 | "test-stream-local", "nohelp", options, &run, NULL); | ||
418 | |||
419 | if (GNUNET_OK != ret) | ||
420 | { | ||
421 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "run failed with error code %d\n", | ||
422 | ret); | ||
423 | return 1; | ||
424 | } | ||
425 | if (GNUNET_SYSERR == result) | ||
426 | { | ||
427 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test failed\n"); | ||
428 | return 1; | ||
429 | } | ||
430 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test ok\n"); | ||
431 | return 0; | ||
432 | } | ||
diff --git a/src/stream/test_stream_local.c b/src/stream/test_stream_local.c index 2eeedeec5..2845a74c2 100644 --- a/src/stream/test_stream_local.c +++ b/src/stream/test_stream_local.c | |||
@@ -35,6 +35,11 @@ | |||
35 | #define VERBOSE 1 | 35 | #define VERBOSE 1 |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * Number of peers | ||
39 | */ | ||
40 | #define NUM_PEERS 2 | ||
41 | |||
42 | /** | ||
38 | * Structure for holding peer's sockets and IO Handles | 43 | * Structure for holding peer's sockets and IO Handles |
39 | */ | 44 | */ |
40 | struct PeerData | 45 | struct PeerData |
@@ -65,43 +70,79 @@ struct PeerData | |||
65 | unsigned int bytes_read; | 70 | unsigned int bytes_read; |
66 | }; | 71 | }; |
67 | 72 | ||
68 | static struct GNUNET_OS_Process *arm_pid; | 73 | /** |
74 | * The current peer group | ||
75 | */ | ||
76 | static struct GNUNET_TESTING_PeerGroup *pg; | ||
77 | |||
78 | /** | ||
79 | * Peer 1 daemon | ||
80 | */ | ||
81 | static struct GNUNET_TESTING_Daemon *d1; | ||
82 | |||
83 | /** | ||
84 | * Peer 2 daemon | ||
85 | */ | ||
86 | static struct GNUNET_TESTING_Daemon *d2; | ||
87 | |||
69 | static struct PeerData peer1; | 88 | static struct PeerData peer1; |
70 | static struct PeerData peer2; | 89 | static struct PeerData peer2; |
71 | static struct GNUNET_STREAM_ListenSocket *peer2_listen_socket; | 90 | static struct GNUNET_STREAM_ListenSocket *peer2_listen_socket; |
72 | static struct GNUNET_CONFIGURATION_Handle *config; | 91 | static struct GNUNET_CONFIGURATION_Handle *config; |
73 | 92 | ||
74 | static GNUNET_SCHEDULER_TaskIdentifier abort_task; | 93 | static GNUNET_SCHEDULER_TaskIdentifier abort_task; |
75 | static GNUNET_SCHEDULER_TaskIdentifier test_task; | ||
76 | static GNUNET_SCHEDULER_TaskIdentifier read_task; | 94 | static GNUNET_SCHEDULER_TaskIdentifier read_task; |
77 | 95 | ||
78 | static char *data = "ABCD"; | 96 | static char *data = "ABCD"; |
79 | static int result; | 97 | static int result; |
80 | 98 | ||
99 | |||
100 | /** | ||
101 | * Check whether peers successfully shut down. | ||
102 | */ | ||
103 | static void | ||
104 | shutdown_callback (void *cls, const char *emsg) | ||
105 | { | ||
106 | if (emsg != NULL) | ||
107 | { | ||
108 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
109 | "Shutdown of peers failed!\n"); | ||
110 | } | ||
111 | else | ||
112 | { | ||
113 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
114 | "All peers successfully shut down!\n"); | ||
115 | } | ||
116 | GNUNET_CONFIGURATION_destroy (config); | ||
117 | } | ||
118 | |||
119 | |||
81 | /** | 120 | /** |
82 | * Shutdown nicely | 121 | * Shutdown nicely |
83 | */ | 122 | */ |
84 | static void | 123 | static void |
85 | do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 124 | do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
86 | { | 125 | { |
87 | GNUNET_STREAM_close (peer1.socket); | 126 | if (NULL != peer1.socket) |
127 | GNUNET_STREAM_close (peer1.socket); | ||
88 | if (NULL != peer2.socket) | 128 | if (NULL != peer2.socket) |
89 | GNUNET_STREAM_close (peer2.socket); | 129 | GNUNET_STREAM_close (peer2.socket); |
130 | if (NULL != peer2_listen_socket) | ||
131 | GNUNET_STREAM_listen_close (peer2_listen_socket); | ||
132 | |||
90 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: shutdown\n"); | 133 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: shutdown\n"); |
91 | if (0 != abort_task) | 134 | if (0 != abort_task) |
92 | { | 135 | { |
93 | GNUNET_SCHEDULER_cancel (abort_task); | 136 | GNUNET_SCHEDULER_cancel (abort_task); |
94 | } | 137 | } |
95 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: arm\n"); | 138 | |
96 | if (0 != GNUNET_OS_process_kill (arm_pid, SIGTERM)) | ||
97 | { | ||
98 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | ||
99 | } | ||
100 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Wait\n"); | 139 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Wait\n"); |
101 | /* Free the duplicated configuration */ | 140 | |
102 | GNUNET_CONFIGURATION_destroy (config); | 141 | GNUNET_TESTING_daemons_stop (pg, |
103 | GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (arm_pid)); | 142 | GNUNET_TIME_relative_multiply |
104 | GNUNET_OS_process_close (arm_pid); | 143 | (GNUNET_TIME_UNIT_SECONDS, 5), |
144 | &shutdown_callback, | ||
145 | NULL); | ||
105 | } | 146 | } |
106 | 147 | ||
107 | 148 | ||
@@ -112,10 +153,6 @@ static void | |||
112 | do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 153 | do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
113 | { | 154 | { |
114 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: ABORT\n"); | 155 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: ABORT\n"); |
115 | if (0 != test_task) | ||
116 | { | ||
117 | GNUNET_SCHEDULER_cancel (test_task); | ||
118 | } | ||
119 | if (0 != read_task) | 156 | if (0 != read_task) |
120 | { | 157 | { |
121 | GNUNET_SCHEDULER_cancel (read_task); | 158 | GNUNET_SCHEDULER_cancel (read_task); |
@@ -317,7 +354,7 @@ stream_listen_cb (void *cls, | |||
317 | const struct GNUNET_PeerIdentity *initiator) | 354 | const struct GNUNET_PeerIdentity *initiator) |
318 | { | 355 | { |
319 | GNUNET_assert (NULL != socket); | 356 | GNUNET_assert (NULL != socket); |
320 | GNUNET_assert (NULL == initiator); /* Local peer=NULL? */ | 357 | GNUNET_assert (NULL != initiator); |
321 | GNUNET_assert (socket != peer1.socket); | 358 | GNUNET_assert (socket != peer1.socket); |
322 | 359 | ||
323 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 360 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -330,36 +367,47 @@ stream_listen_cb (void *cls, | |||
330 | 367 | ||
331 | 368 | ||
332 | /** | 369 | /** |
333 | * Testing function | 370 | * Callback to be called when testing peer group is ready |
334 | * | 371 | * |
335 | * @param cls NULL | 372 | * @param cls NULL |
336 | * @param tc the task context | 373 | * @param emsg NULL on success |
337 | */ | 374 | */ |
338 | static void | 375 | void |
339 | test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 376 | peergroup_ready (void *cls, const char *emsg) |
340 | { | 377 | { |
341 | struct GNUNET_PeerIdentity self; | 378 | if (NULL != emsg) |
342 | 379 | { | |
343 | test_task = GNUNET_SCHEDULER_NO_TASK; | 380 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
344 | /* Get our identity */ | 381 | "Starting peer group failed: %s\n", emsg); |
345 | GNUNET_assert (GNUNET_OK == GNUNET_TESTING_get_peer_identity (config, | 382 | return; |
346 | &self)); | 383 | } |
384 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
385 | "Peer group is now read \n"); | ||
386 | |||
387 | GNUNET_assert (2 == GNUNET_TESTING_daemons_running (pg)); | ||
388 | |||
389 | d1 = GNUNET_TESTING_daemon_get (pg, 0); | ||
390 | GNUNET_assert (NULL != d1); | ||
391 | |||
392 | d2 = GNUNET_TESTING_daemon_get (pg, 1); | ||
393 | GNUNET_assert (NULL != d2); | ||
347 | 394 | ||
348 | peer2_listen_socket = GNUNET_STREAM_listen (config, | 395 | peer2_listen_socket = GNUNET_STREAM_listen (d2->cfg, |
349 | 10, /* App port */ | 396 | 10, /* App port */ |
350 | &stream_listen_cb, | 397 | &stream_listen_cb, |
351 | NULL); | 398 | NULL); |
352 | GNUNET_assert (NULL != peer2_listen_socket); | 399 | GNUNET_assert (NULL != peer2_listen_socket); |
353 | 400 | ||
354 | /* Connect to stream library */ | 401 | /* Connect to stream library */ |
355 | peer1.socket = GNUNET_STREAM_open (config, | 402 | peer1.socket = GNUNET_STREAM_open (d1->cfg, |
356 | &self, /* Null for local peer? */ | 403 | &d2->id, /* Null for local peer? */ |
357 | 10, /* App port */ | 404 | 10, /* App port */ |
358 | &stream_open_cb, | 405 | &stream_open_cb, |
359 | (void *) &peer1); | 406 | &peer1); |
360 | GNUNET_assert (NULL != peer1.socket); | 407 | GNUNET_assert (NULL != peer1.socket); |
361 | } | 408 | } |
362 | 409 | ||
410 | |||
363 | /** | 411 | /** |
364 | * Initialize framework and start test | 412 | * Initialize framework and start test |
365 | */ | 413 | */ |
@@ -367,30 +415,33 @@ static void | |||
367 | run (void *cls, char *const *args, const char *cfgfile, | 415 | run (void *cls, char *const *args, const char *cfgfile, |
368 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 416 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
369 | { | 417 | { |
370 | GNUNET_log_setup ("test_stream_local", | 418 | struct GNUNET_TESTING_Host *hosts; /* FIXME: free hosts (DLL) */ |
371 | #if VERBOSE | 419 | |
372 | "DEBUG", | 420 | /* GNUNET_log_setup ("test_stream_local", */ |
373 | #else | 421 | /* "DEBUG", */ |
374 | "WARNING", | 422 | /* NULL); */ |
375 | #endif | ||
376 | NULL); | ||
377 | /* Duplicate the configuration */ | ||
378 | config = GNUNET_CONFIGURATION_dup (cfg); | ||
379 | arm_pid = | ||
380 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", | ||
381 | "gnunet-service-arm", | ||
382 | #if VERBOSE_ARM | ||
383 | "-L", "DEBUG", | ||
384 | #endif | ||
385 | "-c", "test_stream_local.conf", NULL); | ||
386 | |||
387 | abort_task = | ||
388 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | ||
389 | (GNUNET_TIME_UNIT_SECONDS, 20), &do_abort, | ||
390 | NULL); | ||
391 | |||
392 | test_task = GNUNET_SCHEDULER_add_now (&test, NULL); | ||
393 | 423 | ||
424 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
425 | "Starting test\n"); | ||
426 | /* Duplicate the configuration */ | ||
427 | config = GNUNET_CONFIGURATION_dup (cfg); | ||
428 | |||
429 | hosts = GNUNET_TESTING_hosts_load (config); | ||
430 | |||
431 | pg = GNUNET_TESTING_peergroup_start (config, | ||
432 | 2, | ||
433 | GNUNET_TIME_relative_multiply | ||
434 | (GNUNET_TIME_UNIT_SECONDS, 3), | ||
435 | NULL, | ||
436 | &peergroup_ready, | ||
437 | NULL, | ||
438 | hosts); | ||
439 | GNUNET_assert (NULL != pg); | ||
440 | |||
441 | abort_task = | ||
442 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | ||
443 | (GNUNET_TIME_UNIT_SECONDS, 40), &do_abort, | ||
444 | NULL); | ||
394 | } | 445 | } |
395 | 446 | ||
396 | /** | 447 | /** |
@@ -400,18 +451,15 @@ int main (int argc, char **argv) | |||
400 | { | 451 | { |
401 | int ret; | 452 | int ret; |
402 | 453 | ||
403 | char *const argv2[] = { "test-stream-local", | 454 | char *argv2[] = { "test-stream-local", |
404 | "-c", "test_stream_local.conf", | 455 | "-L", "DEBUG", |
405 | #if VERBOSE | 456 | "-c", "test_stream_local.conf", |
406 | "-L", "DEBUG", | 457 | NULL}; |
407 | #endif | ||
408 | NULL | ||
409 | }; | ||
410 | 458 | ||
411 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 459 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
412 | GNUNET_GETOPT_OPTION_END | 460 | GNUNET_GETOPT_OPTION_END |
413 | }; | 461 | }; |
414 | 462 | ||
415 | ret = | 463 | ret = |
416 | GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2, | 464 | GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2, |
417 | "test-stream-local", "nohelp", options, &run, NULL); | 465 | "test-stream-local", "nohelp", options, &run, NULL); |
@@ -427,6 +475,6 @@ int main (int argc, char **argv) | |||
427 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test failed\n"); | 475 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test failed\n"); |
428 | return 1; | 476 | return 1; |
429 | } | 477 | } |
430 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test ok\n"); | 478 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "test ok\n"); |
431 | return 0; | 479 | return 0; |
432 | } | 480 | } |
diff --git a/src/stream/test_stream_local.conf b/src/stream/test_stream_local.conf index 3f229c302..db5db0bf0 100644 --- a/src/stream/test_stream_local.conf +++ b/src/stream/test_stream_local.conf | |||
@@ -53,7 +53,13 @@ TIMEOUT = 300 s | |||
53 | PORT = 12368 | 53 | PORT = 12368 |
54 | 54 | ||
55 | [TESTING] | 55 | [TESTING] |
56 | NUM_PEERS = 5 | ||
56 | WEAKRANDOM = YES | 57 | WEAKRANDOM = YES |
58 | DEBUG = YES | ||
59 | HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat | ||
60 | MAX_CONCURRENT_SSH = 10 | ||
61 | USE_PROGRESSBARS = YES | ||
62 | PEERGROUP_TIMEOUT = 2400 s | ||
57 | 63 | ||
58 | [gnunetd] | 64 | [gnunetd] |
59 | HOSTKEY = $SERVICEHOME/.hostkey | 65 | HOSTKEY = $SERVICEHOME/.hostkey |