Ejemplo n.º 1
0
void TestPlugin::initialize()
{
    NamedList* httpdconf = 0;
    Output("Initializing module TestHttpBase");
    Configuration cfg;
    cfg = Engine::configFile("httpserver");
    cfg.load();
    for (unsigned int i = 0; i < cfg.sections(); i++) {
	httpdconf = cfg.getSection(i);
	String name = httpdconf ? httpdconf->c_str() : "";
	if (! name.startSkip("listener ",false))
	    continue;
	name.trimBlanks();
	httpdconf->String::operator=(name);
	break; // XXX only first listener
    }
    if (m_first)
	m_testThread = new TestThread;
    m_testThread->configure(*httpdconf);
    if (m_first) {
	m_first = false;
	m_testThread->startup();
	Engine::install(new TestHandler("http.request"));
    }
//    delete httpdconf;
}
Ejemplo n.º 2
0
void TestPlugin1::initialize()
{
    Output("Initializing module TestPlugin1");
    Configuration *cfg = new Configuration(Engine::configFile("test1"));
    noisy = cfg->getBoolValue("general","noisy");
    int n = cfg->getIntValue("general","threads");
    delete cfg;
    Engine::install(new TestHandler("engine.halt"));
    Engine::install(new TestHandler(""));
    Engine::enqueue(new Message("test.queued1"));
    Engine::enqueue(new Message("test.queued2"));
    if (m_first) {
	m_first = false;
	for (int i=0; i<n; i++) {
	    ::usleep(10000);
	    TestThread *t = new TestThread;
	    t->startup();
	}
    }
}