#define SPEED_ACK 4
#define SPEED_MIN 5
#define SPEED_NOBUF 6
+#define P2P_SIGNAL 10
/**
* Which test are we running?
static void
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- fprintf(stderr, "b");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n");
shutdown_handle = GNUNET_SCHEDULER_NO_TASK;
}
long line = (long) cls;
unsigned int i;
- fprintf(stderr, "a");
for (i = 0; i < 3; i++)
if (NULL != t_op[i])
{
}
+/**
+ * Abort test: schedule disconnect and shutdown immediately
+ *
+ * @param line Line in the code the abort is requested from (__LINE__).
+ */
void
abort_test (long line)
{
{
GNUNET_SCHEDULER_cancel (disconnect_task);
}
- disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
- &disconnect_mesh_peers,
- (void *) line);
+ disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
+ &disconnect_mesh_peers,
+ (void *) line);
}
/**
if (size < size_payload || NULL == buf)
{
GNUNET_break (0);
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"size %u, buf %p, data_sent %u, data_received %u\n",
size,
buf,
return GNUNET_OK;
show_end_data();
}
- GNUNET_MESH_tunnel_destroy (t);
- t = NULL;
+ if (test == P2P_SIGNAL)
+ {
+ GNUNET_MESH_tunnel_destroy (incoming_t);
+ incoming_t = NULL;
+ }
+ else
+ {
+ GNUNET_MESH_tunnel_destroy (t);
+ t = NULL;
+ }
}
if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"peer %s disconnected\n",
GNUNET_i2s (peer));
+ if (P2P_SIGNAL == test)
+ {
+ ok ++;
+ if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
+ {
+ GNUNET_SCHEDULER_cancel (disconnect_task);
+ }
+ disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_mesh_peers,
+ (void *) __LINE__);
+ }
return;
}
struct GNUNET_PeerIdentity *dest;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "peer %s connected\n", GNUNET_i2s (peer));
+ "%ld peer %s connected\n", i, GNUNET_i2s (peer));
if (0 == memcmp (p_id[2], peer, sizeof (struct GNUNET_PeerIdentity)) &&
i == 0L)
switch (test)
{
case UNICAST:
+ case P2P_SIGNAL:
case SPEED:
case SPEED_ACK:
// incoming_t is NULL unless we send a relevant data packet
if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
{
GNUNET_SCHEDULER_cancel (disconnect_task);
- disconnect_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT, &disconnect_mesh_peers,
- (void *) __LINE__);
}
+ disconnect_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
+ &disconnect_mesh_peers,
+ (void *) __LINE__);
}
/**
return;
}
p_id[i] = pinfo->result.id;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " id: %s\n", GNUNET_i2s (p_id[i]));
p_ids++;
if ((MULTICAST == test && p_ids < 3) || p_ids < 2)
return;
peers_running = num_peers;
h1 = meshes[0];
h2 = meshes[num_peers - 1];
- t = GNUNET_MESH_tunnel_create (h1, NULL, &ch, &dh, (void *) 1L);
+ t = GNUNET_MESH_tunnel_create (h1, NULL, &ch, &dh, (void *) 0L);
if (SPEED_MIN == test)
{
GNUNET_MESH_tunnel_speed_min(t);
test_name = "multicast";
ok_goal = 10;
}
+ else if (strstr (argv[0], "test_mesh_small_signal") != NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SIGNAL\n");
+ test = P2P_SIGNAL;
+ test_name = "signal";
+ ok_goal = 5;
+ }
else if (strstr (argv[0], "test_mesh_small_speed_ack") != NULL)
{
/* Each peer is supposed to generate the following callbacks:
}
p_ids = 0;
- GNUNET_MESH_TEST_run (test_name,
+ GNUNET_MESH_TEST_run ("test_mesh_small",
"test_mesh_small.conf",
5,
&tmain,