aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/test_mesh_local.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesh/test_mesh_local.c')
-rw-r--r--src/mesh/test_mesh_local.c50
1 files changed, 39 insertions, 11 deletions
diff --git a/src/mesh/test_mesh_local.c b/src/mesh/test_mesh_local.c
index 789a2f63e..bf81ccc8e 100644
--- a/src/mesh/test_mesh_local.c
+++ b/src/mesh/test_mesh_local.c
@@ -41,6 +41,15 @@ static int result;
41static GNUNET_SCHEDULER_TaskIdentifier abort_task; 41static GNUNET_SCHEDULER_TaskIdentifier abort_task;
42static GNUNET_SCHEDULER_TaskIdentifier test_task; 42static GNUNET_SCHEDULER_TaskIdentifier test_task;
43 43
44static struct GNUNET_MESH_MessageHandler handlers1[] = {
45 {&callback, 1, 0},
46 {NULL, 0, 0}
47};
48
49static struct GNUNET_MESH_MessageHandler handlers2[] = { {NULL, 0, 0} };
50
51
52
44/** 53/**
45 * Function is called whenever a message is received. 54 * Function is called whenever a message is received.
46 * 55 *
@@ -59,15 +68,37 @@ callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx,
59 const struct GNUNET_MessageHeader *message, 68 const struct GNUNET_MessageHeader *message,
60 const struct GNUNET_TRANSPORT_ATS_Information *atsi) 69 const struct GNUNET_TRANSPORT_ATS_Information *atsi)
61{ 70{
71 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Data callback\n");
62 return GNUNET_OK; 72 return GNUNET_OK;
63} 73}
64 74
65static struct GNUNET_MESH_MessageHandler handlers1[] = {
66 {&callback, 1, 0},
67 {NULL, 0, 0}
68};
69 75
70static struct GNUNET_MESH_MessageHandler handlers2[] = {{NULL, 0, 0}}; 76/**
77 * Method called whenever another peer has added us to a tunnel
78 * the other peer initiated.
79 *
80 * @param cls closure
81 * @param tunnel new handle to the tunnel
82 * @param initiator peer that started the tunnel
83 * @param atsi performance information for the tunnel
84 * @return initial tunnel context for the tunnel (can be NULL -- that's not an error)
85 */
86static void *
87inbound_tunnel (void *cls, struct GNUNET_MESH_Tunnel *tunnel,
88 const struct GNUNET_PeerIdentity *initiator,
89 const structGNUNET_TRANSPORT_ATS_Information * atsi)
90{
91 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: \n");
92 return NULL;
93}
94
95
96
97
98
99
100
101
71 102
72 103
73static void 104static void
@@ -116,8 +147,7 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
116 struct GNUNET_CONFIGURATION_Handle *cfg = cls; 147 struct GNUNET_CONFIGURATION_Handle *cfg = cls;
117 static const GNUNET_MESH_ApplicationType app1[] = 148 static const GNUNET_MESH_ApplicationType app1[] =
118 { 1, 2, 3, 4, 5, 6, 7, 8, 0 }; 149 { 1, 2, 3, 4, 5, 6, 7, 8, 0 };
119 static const GNUNET_MESH_ApplicationType app2[] = 150 static const GNUNET_MESH_ApplicationType app2[] = { 0 };
120 { 0 };
121 151
122 test_task = (GNUNET_SCHEDULER_TaskIdentifier) 0; 152 test_task = (GNUNET_SCHEDULER_TaskIdentifier) 0;
123 mesh_peer_1 = GNUNET_MESH_connect (cfg, 10, 1, NULL, NULL, handlers1, app1); 153 mesh_peer_1 = GNUNET_MESH_connect (cfg, 10, 1, NULL, NULL, handlers1, app1);
@@ -135,10 +165,8 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
135 t_1 = GNUNET_MESH_tunnel_create (mesh_peer_1, NULL, NULL, NULL, 1); 165 t_1 = GNUNET_MESH_tunnel_create (mesh_peer_1, NULL, NULL, NULL, 1);
136// t_2 = GNUNET_MESH_tunnel_create (mesh_peer_2, NULL, NULL, NULL, 2); 166// t_2 = GNUNET_MESH_tunnel_create (mesh_peer_2, NULL, NULL, NULL, 2);
137 167
138 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply( 168 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
139 GNUNET_TIME_UNIT_SECONDS, 169 (GNUNET_TIME_UNIT_SECONDS, 2), &do_shutdown,
140 2),
141 &do_shutdown,
142 NULL); 170 NULL);
143} 171}
144 172