#include "gnunet_testing_lib.h"
#include "gnunet_mesh_service.h"
-#define VERBOSE GNUNET_YES
#define REMOVE_DIR GNUNET_YES
-#define MESH_REGEX_PEERS 3
+#define MESH_REGEX_PEERS 4
/**
* How long until we give up on connecting the peers?
*/
#define SHORT_TIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
-
/**
* Which strings have been found & connected.
*/
"0123456789A*BC",
- "0*123456789ABC*"};
+ "0*123456789ABC*",
+
+ "GNUNETVPN0001000IPEX401110011101100100000111(0|1)*"};
/**
"0123456789AABC",
- "00123456789ABCCCC"};
+ "00123456789ABCCCC",
+
+ "GNUNETVPN0001000IPEX401110011101100100000111"};
/**
* Check whether peers successfully shut down.
for (i = 0; i < MESH_REGEX_PEERS; i++)
ok[i] = GNUNET_NO;
}
-#if VERBOSE
else
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"test: All peers successfully shut down!\n");
}
-#endif
GNUNET_CONFIGURATION_destroy (testing_cfg);
}
static void
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Ending test.\n");
-#endif
shutdown_handle = GNUNET_SCHEDULER_NO_TASK;
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
}
/**
* Ends test: Disconnects peers and calls shutdown.
* @param cls Closure (not used).
- * @param tc TaskContext.
+ * @param tc TaskContext.
*/
static void
disconnect_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
"Peer connected: %s\n",
GNUNET_i2s (peer));
regex_peers++;
-
- GNUNET_MESH_notify_transmit_ready(t[i], 0, 0,
+
+ GNUNET_MESH_notify_transmit_ready(t[i], GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
peer,
sizeof(struct GNUNET_MessageHeader),
GNUNET_SCHEDULER_cancel (disconnect_task);
disconnect_task =
GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL);
- }
+ }
return GNUNET_OK;
}
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
return;
}
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "test: Peer Group started successfully!\n");
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "test: Have %u connections\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Peer Group started successfully with %u connections\n",
total_connections);
-#endif
-
peers_running = GNUNET_TESTING_daemons_running (pg);
if (0 < failed_connections)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Connect to mesh\n");
- h1 = GNUNET_MESH_connect (d->cfg, 5, (void *) 1L,
+ h1 = GNUNET_MESH_connect (d->cfg, (void *) 1L,
NULL,
NULL,
handlers,
{
ok[i] = GNUNET_NO;
d = GNUNET_TESTING_daemon_get (pg, 10 + i);
- h2[i] = GNUNET_MESH_connect (d->cfg, 5, (void *) (long) (i + 2),
+ h2[i] = GNUNET_MESH_connect (d->cfg, (void *) (long) (i + 2),
&incoming_tunnel,
&tunnel_cleaner,
handlers,
&app);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Announce REGEX %u: %s\n", i, regexes[i]);
- GNUNET_MESH_announce_regex (h2[i], regexes[i]);
+ GNUNET_MESH_announce_regex (h2[i], regexes[i], 1);
}
for (i = 0; i < MESH_REGEX_PEERS; i++)
GNUNET_MESH_peer_request_connect_by_string (t[i], strings[i]);
}
/* connect handler = success, timeout = error */
-
+
}
testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
GNUNET_log_setup ("test_mesh_regex",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
-
-#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Starting daemons.\n");
- GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing_old",
- "use_progressbars", "YES");
-#endif
-
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (testing_cfg, "testing_old",
"num_peers", &num_peers))
argv[0],
"-c",
"test_mesh_2dtorus.conf",
-#if VERBOSE
- "-L",
- "DEBUG",
-#endif
NULL
};
int result;