aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/test_mesh_local_2.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_2.c
parentf709218364f7d40e5a13938886514e866602715d (diff)
downloadgnunet-1fe79fd553e21a20206301c18568d30158c9dd46.tar.gz
gnunet-1fe79fd553e21a20206301c18568d30158c9dd46.zip
indentation
Diffstat (limited to 'src/mesh/test_mesh_local_2.c')
-rw-r--r--src/mesh/test_mesh_local_2.c44
1 files changed, 19 insertions, 25 deletions
diff --git a/src/mesh/test_mesh_local_2.c b/src/mesh/test_mesh_local_2.c
index 9da611bf4..b29921dd3 100644
--- a/src/mesh/test_mesh_local_2.c
+++ b/src/mesh/test_mesh_local_2.c
@@ -80,7 +80,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
80static void 80static void
81do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 81do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
82{ 82{
83 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: ABORT\n"); 83 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: ABORT\n");
84 if (0 != test_task) 84 if (0 != test_task)
85 { 85 {
86 GNUNET_SCHEDULER_cancel (test_task); 86 GNUNET_SCHEDULER_cancel (test_task);
@@ -105,9 +105,9 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
105 */ 105 */
106static int 106static int
107data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx, 107data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx,
108 const struct GNUNET_PeerIdentity *sender, 108 const struct GNUNET_PeerIdentity *sender,
109 const struct GNUNET_MessageHeader *message, 109 const struct GNUNET_MessageHeader *message,
110 const struct GNUNET_TRANSPORT_ATS_Information *atsi) 110 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
111{ 111{
112 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Data callback\n"); 112 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Data callback\n");
113 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 113 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
@@ -138,7 +138,7 @@ inbound_tunnel (void *cls, struct GNUNET_MESH_Tunnel *tunnel,
138 if (id != 1) 138 if (id != 1)
139 { 139 {
140 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 140 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
141 "test: received incoming tunnel on peer 2\n"); 141 "test: received incoming tunnel on peer 2\n");
142 result = GNUNET_SYSERR; 142 result = GNUNET_SYSERR;
143 } 143 }
144 return NULL; 144 return NULL;
@@ -155,8 +155,7 @@ inbound_tunnel (void *cls, struct GNUNET_MESH_Tunnel *tunnel,
155 * with the tunnel is stored 155 * with the tunnel is stored
156 */ 156 */
157static void 157static void
158inbound_end (void *cls, 158inbound_end (void *cls, const struct GNUNET_MESH_Tunnel *tunnel,
159 const struct GNUNET_MESH_Tunnel * tunnel,
160 void *tunnel_ctx) 159 void *tunnel_ctx)
161{ 160{
162 unsigned int id = (unsigned int) cls; 161 unsigned int id = (unsigned int) cls;
@@ -165,7 +164,7 @@ inbound_end (void *cls,
165 if (id != 1) 164 if (id != 1)
166 { 165 {
167 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 166 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
168 "test: received closing tunnel on peer 2\n"); 167 "test: received closing tunnel on peer 2\n");
169 result = GNUNET_SYSERR; 168 result = GNUNET_SYSERR;
170 } 169 }
171} 170}
@@ -177,12 +176,11 @@ inbound_end (void *cls,
177 * @param cls closure 176 * @param cls closure
178 * @param peer peer identity the tunnel stopped working with 177 * @param peer peer identity the tunnel stopped working with
179 */ 178 */
180static void peer_conected ( 179static void
181 void *cls, 180peer_conected (void *cls, const struct GNUNET_PeerIdentity *peer)
182 const struct GNUNET_PeerIdentity * peer)
183{ 181{
184 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer connected\n"); 182 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer connected\n");
185 GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS, &do_shutdown, NULL); 183 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown, NULL);
186} 184}
187 185
188 186
@@ -193,10 +191,9 @@ static void peer_conected (
193 * @param peer peer identity the tunnel was created to, NULL on timeout 191 * @param peer peer identity the tunnel was created to, NULL on timeout
194 * @param atsi performance data for the connection 192 * @param atsi performance data for the connection
195 */ 193 */
196static void peer_disconnected ( 194static void
197 void *cls, 195peer_disconnected (void *cls, const struct GNUNET_PeerIdentity *peer,
198 const struct GNUNET_PeerIdentity * peer, 196 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
199 const struct GNUNET_TRANSPORT_ATS_Information * atsi)
200{ 197{
201 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer disconnected\n"); 198 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: peer disconnected\n");
202} 199}
@@ -265,15 +262,12 @@ 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 *) 2);
270 &peer_conected, 267 GNUNET_MESH_peer_request_connect_by_type (t, 1);
271 &peer_disconnected, 268 test_task =
272 (void *) 2); 269 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
273 GNUNET_MESH_peer_request_connect_by_type(t, 1); 270 &do_connect_peer_1, cfg);
274 test_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_SECONDS,
275 &do_connect_peer_1,
276 cfg);
277} 271}
278 272
279 273