Fix listener registration in load-tester plugin.
authorTobias Brunner <tobias@strongswan.org>
Mon, 18 Jul 2011 16:42:21 +0000 (18:42 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 18 Jul 2011 16:46:50 +0000 (18:46 +0200)
This fixes the load-tester.shutdown_when_complete option.

src/libcharon/plugins/load_tester/load_tester_plugin.c

index f97b4c4..a59fa23 100644 (file)
@@ -234,21 +234,20 @@ plugin_t *load_tester_plugin_create()
                .condvar = condvar_create(CONDVAR_TYPE_DEFAULT),
                .config = load_tester_config_create(),
                .creds = load_tester_creds_create(),
-               .listener = load_tester_listener_create(shutdown_on),
        );
 
        lib->crypto->add_dh(lib->crypto, MODP_NULL, plugin_name,
                                                (dh_constructor_t)load_tester_diffie_hellman_create);
        charon->backends->add_backend(charon->backends, &this->config->backend);
        lib->credmgr->add_set(lib->credmgr, &this->creds->credential_set);
-       charon->bus->add_listener(charon->bus, &this->listener->listener);
 
        if (lib->settings->get_bool(lib->settings,
                                        "charon.plugins.load-tester.shutdown_when_complete", 0))
        {
                shutdown_on = this->iterations * this->initiators;
        }
-
+       this->listener = load_tester_listener_create(shutdown_on);
+       charon->bus->add_listener(charon->bus, &this->listener->listener);
 
        if (lib->settings->get_bool(lib->settings,
                                        "charon.plugins.load-tester.fake_kernel", FALSE))