*/
struct GNUNET_TRANSPORT_PluginFunctions *api;
+/**
+ * Helper handler
+ */
+struct GNUNET_HELPER_Handle *suid_helper;
+
/**
* Timeout task
*/
GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
stats = NULL;
+ if (NULL != suid_helper)
+ {
+ GNUNET_HELPER_stop (suid_helper);
+ suid_helper = NULL;
+ }
+
ok = 0;
}
stats = NULL;
}
+ if (NULL != suid_helper)
+ {
+ GNUNET_HELPER_stop (suid_helper);
+ suid_helper = NULL;
+ }
+
ok = 1;
}
{
timeout_wait = GNUNET_SCHEDULER_NO_TASK;
if (0 == addresses_reported)
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Plugin did not report any addresses, could not check plugin \n"));
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("Plugin did not report any addresses, could not check address conversion functions\n"));
end ();
}
env_notify_address (void *cls,
int add_remove,
const void *addr,
- size_t addrlen)
+ size_t addrlen,
+ const char *plugin)
{
struct AddressWrapper *w;
char *a2s;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Plugin added address `%s'\n"), a2s);
- if (GNUNET_OK != api->string_to_address (api, a2s, strlen (a2s)+1, &s2a, &s2a_len))
+ if ((GNUNET_OK != api->string_to_address (api, a2s, strlen (a2s)+1, &s2a, &s2a_len)) || (NULL == s2a))
{
GNUNET_break (0);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Plugin creates different address length when connecting back and forth!\n"));
}
-
+ GNUNET_free (s2a);
+ GNUNET_free (a2s);
if (GNUNET_OK != api->check_address (api->cls, w->addr, w->addrlen))
{
GNUNET_break (0);
env.session_end = &env_session_end;
}
+static int
+handle_helper_message (void *cls, void *client,
+ const struct GNUNET_MessageHeader *hdr)
+{
+ return GNUNET_OK;
+}
/**
* Runs the test.
/* load plugins... */
setup_plugin_environment ();
- plugin = strrchr(argv[0],'_');
+ GNUNET_assert (strlen (argv[0]) > strlen ("test_plugin_"));
+ plugin = strstr(argv[0],"test_plugin_");
sep = strrchr(argv[0],'.');
if (NULL == plugin)
{
end_badly_now ();
return;
}
- plugin++;
+ plugin += strlen ("test_plugin_");
if (NULL != sep)
sep[0] = '\0';
+ /* Hack for WLAN: start a second helper */
+ if (0 == strcmp (plugin, "wlan"))
+ {
+ char * helper_argv[3];
+ helper_argv[0] = (char *) "gnunet-helper-transport-wlan-dummy";
+ helper_argv[1] = (char *) "2";
+ helper_argv[2] = NULL;
+ suid_helper = GNUNET_HELPER_start ("gnunet-helper-transport-wlan-dummy",
+ helper_argv,
+ &handle_helper_message,
+ NULL,
+ NULL);
+ }
+
+
/* Loading plugin */
GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Loading transport plugin %s\n"), plugin);
GNUNET_asprintf (&libname, "libgnunet_plugin_transport_%s", plugin);