aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/test_mesh_local_1.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-09-14 11:59:46 +0000
committerChristian Grothoff <christian@grothoff.org>2011-09-14 11:59:46 +0000
commit1fe79fd553e21a20206301c18568d30158c9dd46 (patch)
tree3db4e42adb872d1e8aa792643c341a14b2959736 /src/mesh/test_mesh_local_1.c
parentf709218364f7d40e5a13938886514e866602715d (diff)
downloadgnunet-1fe79fd553e21a20206301c18568d30158c9dd46.tar.gz
gnunet-1fe79fd553e21a20206301c18568d30158c9dd46.zip
indentation
Diffstat (limited to 'src/mesh/test_mesh_local_1.c')
-rw-r--r--src/mesh/test_mesh_local_1.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/src/mesh/test_mesh_local_1.c b/src/mesh/test_mesh_local_1.c
index 4e8d0b78e..5c45f2895 100644
--- a/src/mesh/test_mesh_local_1.c
+++ b/src/mesh/test_mesh_local_1.c
@@ -107,9 +107,9 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
107 */ 107 */
108static int 108static int
109data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx, 109data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx,
110 const struct GNUNET_PeerIdentity *sender, 110 const struct GNUNET_PeerIdentity *sender,
111 const struct GNUNET_MessageHeader *message, 111 const struct GNUNET_MessageHeader *message,
112 const struct GNUNET_TRANSPORT_ATS_Information *atsi) 112 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
113{ 113{
114 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Data callback\n"); 114 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Data callback\n");
115 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 115 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
@@ -140,7 +140,7 @@ inbound_tunnel (void *cls, struct GNUNET_MESH_Tunnel *tunnel,
140 if (id != 1) 140 if (id != 1)
141 { 141 {
142 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 142 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
143 "test: received incoming tunnel on peer 2\n"); 143 "test: received incoming tunnel on peer 2\n");
144 result = GNUNET_SYSERR; 144 result = GNUNET_SYSERR;
145 } 145 }
146 return NULL; 146 return NULL;
@@ -157,8 +157,7 @@ inbound_tunnel (void *cls, struct GNUNET_MESH_Tunnel *tunnel,
157 * with the tunnel is stored 157 * with the tunnel is stored
158 */ 158 */
159static void 159static void
160inbound_end (void *cls, 160inbound_end (void *cls, const struct GNUNET_MESH_Tunnel *tunnel,
161 const struct GNUNET_MESH_Tunnel * tunnel,
162 void *tunnel_ctx) 161 void *tunnel_ctx)
163{ 162{
164 unsigned int id = *(unsigned int *) cls; 163 unsigned int id = *(unsigned int *) cls;
@@ -167,7 +166,7 @@ inbound_end (void *cls,
167 if (id != 1) 166 if (id != 1)
168 { 167 {
169 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 168 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
170 "test: received closing tunnel on peer 2\n"); 169 "test: received closing tunnel on peer 2\n");
171 result = GNUNET_SYSERR; 170 result = GNUNET_SYSERR;
172 } 171 }
173} 172}
@@ -179,13 +178,12 @@ inbound_end (void *cls,
179 * @param cls closure 178 * @param cls closure
180 * @param peer peer identity the tunnel stopped working with 179 * @param peer peer identity the tunnel stopped working with
181 */ 180 */
182static void peer_conected ( 181static void
183 void *cls, 182peer_conected (void *cls, const struct GNUNET_PeerIdentity *peer,
184 const struct GNUNET_PeerIdentity * peer, 183 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
185 const struct GNUNET_TRANSPORT_ATS_Information * atsi)
186{ 184{
187 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer connected\n"); 185 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer connected\n");
188 GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, &do_shutdown, NULL); 186 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown, NULL);
189} 187}
190 188
191 189
@@ -196,9 +194,8 @@ static void peer_conected (
196 * @param peer peer identity the tunnel was created to, NULL on timeout 194 * @param peer peer identity the tunnel was created to, NULL on timeout
197 * @param atsi performance data for the connection 195 * @param atsi performance data for the connection
198 */ 196 */
199static void peer_disconnected ( 197static void
200 void *cls, 198peer_disconnected (void *cls, const struct GNUNET_PeerIdentity *peer)
201 const struct GNUNET_PeerIdentity * peer)
202{ 199{
203 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer disconnected\n"); 200 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer disconnected\n");
204} 201}
@@ -225,7 +222,7 @@ static struct GNUNET_MESH_MessageHandler handlers2[] = { {NULL, 0, 0} };
225static void 222static void
226do_find (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 223do_find (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
227{ 224{
228 GNUNET_MESH_peer_request_connect_by_type(t, 1); 225 GNUNET_MESH_peer_request_connect_by_type (t, 1);
229} 226}
230 227
231 228
@@ -265,12 +262,9 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
265 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: YAY! CONNECTED TO MESH :D\n"); 262 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: YAY! CONNECTED TO MESH :D\n");
266 } 263 }
267 264
268 t = GNUNET_MESH_tunnel_create (mesh_peer_2, 265 t = GNUNET_MESH_tunnel_create (mesh_peer_2, NULL, &peer_conected,
269 NULL, 266 &peer_disconnected, (void *) &two);
270 &peer_conected, 267 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_find, NULL);
271 &peer_disconnected,
272 (void *) &two);
273 GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, &do_find, NULL);
274} 268}
275 269
276 270