aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_plugin_transport.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-08-27 09:24:21 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-08-27 09:24:21 +0000
commit93292d53e8470b6e7302ccf1c86f7cb12535c7f1 (patch)
treeb078b75f7bee15104df65a02d231f5967c1f3db7 /src/transport/test_plugin_transport.c
parenta4d753e8d938081ec51efa816966a2d6153d29c4 (diff)
downloadgnunet-93292d53e8470b6e7302ccf1c86f7cb12535c7f1.tar.gz
gnunet-93292d53e8470b6e7302ccf1c86f7cb12535c7f1.zip
fix for wlan
Diffstat (limited to 'src/transport/test_plugin_transport.c')
-rw-r--r--src/transport/test_plugin_transport.c41
1 files changed, 40 insertions, 1 deletions
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
@@ -89,6 +89,11 @@ struct GNUNET_TRANSPORT_PluginEnvironment env;
89struct GNUNET_TRANSPORT_PluginFunctions *api; 89struct GNUNET_TRANSPORT_PluginFunctions *api;
90 90
91/** 91/**
92 * Helper handler
93 */
94struct GNUNET_HELPER_Handle *suid_helper;
95
96/**
92 * Timeout task 97 * Timeout task
93 */ 98 */
94static GNUNET_SCHEDULER_TaskIdentifier timeout_task; 99static GNUNET_SCHEDULER_TaskIdentifier timeout_task;
@@ -147,6 +152,12 @@ end ()
147 GNUNET_STATISTICS_destroy (stats, GNUNET_NO); 152 GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
148 stats = NULL; 153 stats = NULL;
149 154
155 if (NULL != suid_helper)
156 {
157 GNUNET_HELPER_stop (suid_helper);
158 suid_helper = NULL;
159 }
160
150 ok = 0; 161 ok = 0;
151} 162}
152 163
@@ -190,6 +201,12 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
190 stats = NULL; 201 stats = NULL;
191 } 202 }
192 203
204 if (NULL != suid_helper)
205 {
206 GNUNET_HELPER_stop (suid_helper);
207 suid_helper = NULL;
208 }
209
193 ok = 1; 210 ok = 1;
194} 211}
195 212
@@ -240,7 +257,8 @@ static void
240env_notify_address (void *cls, 257env_notify_address (void *cls,
241 int add_remove, 258 int add_remove,
242 const void *addr, 259 const void *addr,
243 size_t addrlen) 260 size_t addrlen,
261 const char *plugin)
244{ 262{
245 struct AddressWrapper *w; 263 struct AddressWrapper *w;
246 char *a2s; 264 char *a2s;
@@ -387,6 +405,12 @@ setup_plugin_environment ()
387 env.session_end = &env_session_end; 405 env.session_end = &env_session_end;
388} 406}
389 407
408static int
409handle_helper_message (void *cls, void *client,
410 const struct GNUNET_MessageHeader *hdr)
411{
412 return GNUNET_OK;
413}
390 414
391/** 415/**
392 * Runs the test. 416 * Runs the test.
@@ -464,6 +488,21 @@ run (void *cls, char *const *args, const char *cfgfile,
464 if (NULL != sep) 488 if (NULL != sep)
465 sep[0] = '\0'; 489 sep[0] = '\0';
466 490
491 /* Hack for WLAN: start a second helper */
492 if (0 == strcmp (plugin, "wlan"))
493 {
494 char * helper_argv[3];
495 helper_argv[0] = (char *) "gnunet-helper-transport-wlan-dummy";
496 helper_argv[1] = (char *) "2";
497 helper_argv[2] = NULL;
498 suid_helper = GNUNET_HELPER_start ("gnunet-helper-transport-wlan-dummy",
499 helper_argv,
500 &handle_helper_message,
501 NULL,
502 NULL);
503 }
504
505
467 /* Loading plugin */ 506 /* Loading plugin */
468 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Loading transport plugin %s\n"), plugin); 507 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Loading transport plugin %s\n"), plugin);
469 GNUNET_asprintf (&libname, "libgnunet_plugin_transport_%s", plugin); 508 GNUNET_asprintf (&libname, "libgnunet_plugin_transport_%s", plugin);