From 93292d53e8470b6e7302ccf1c86f7cb12535c7f1 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Mon, 27 Aug 2012 09:24:21 +0000 Subject: [PATCH] fix for wlan --- src/transport/test_plugin_transport.c | 41 ++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c index e3ab5fd56..8f1e1eda1 100644 --- a/src/transport/test_plugin_transport.c +++ b/src/transport/test_plugin_transport.c @@ -88,6 +88,11 @@ struct GNUNET_TRANSPORT_PluginEnvironment env; */ struct GNUNET_TRANSPORT_PluginFunctions *api; +/** + * Helper handler + */ +struct GNUNET_HELPER_Handle *suid_helper; + /** * Timeout task */ @@ -147,6 +152,12 @@ end () GNUNET_STATISTICS_destroy (stats, GNUNET_NO); stats = NULL; + if (NULL != suid_helper) + { + GNUNET_HELPER_stop (suid_helper); + suid_helper = NULL; + } + ok = 0; } @@ -190,6 +201,12 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) stats = NULL; } + if (NULL != suid_helper) + { + GNUNET_HELPER_stop (suid_helper); + suid_helper = NULL; + } + ok = 1; } @@ -240,7 +257,8 @@ static void 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; @@ -387,6 +405,12 @@ setup_plugin_environment () 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. @@ -464,6 +488,21 @@ run (void *cls, char *const *args, const char *cfgfile, 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); -- 2.25.1