Exemplo n.º 1
0
/* the main program... */
int main(int argc,char *argv[])
{
  char *srcdir;
  char fname[100];
  struct sigaction act;
  /* build the name of the file */
  srcdir=getenv("srcdir");
  if (srcdir==NULL)
    srcdir=".";
  snprintf(fname,sizeof(fname),"%s/nslcd-test.conf",srcdir);
  fname[sizeof(fname)-1]='\0';
  /* initialize configuration */
  cfg_init(fname);
  /* partially initialize logging */
  log_setdefaultloglevel(LOG_DEBUG);
  /* ignore SIGPIPE */
  memset(&act,0,sizeof(struct sigaction));
  act.sa_handler=SIG_IGN;
  sigemptyset(&act.sa_mask);
  act.sa_flags=SA_RESTART|SA_NOCLDSTOP;
  assert(sigaction(SIGPIPE,&act,NULL)==0);
  /* do tests */
  test_search();
  test_get();
  test_get_values();
  test_get_rdnvalues();
  test_two_searches();
  test_threads();
  test_connections();
  test_escape();
  return 0;
}
Exemplo n.º 2
0
int main(int argv, char ** argc){
   if(argv > 1 && strcmp(argc[1], "--test") == 0){
    test_connections();
    logd("TEST SUCCESS\n");
    return 0;
    }
  web_context ctx = {0};
  load_available_con(&ctx);

  struct MHD_Daemon * d = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION, 8000,
					   NULL, NULL, &web_main, &ctx, MHD_OPTION_END);
  logd("%i\n", d);
  while(false == ctx.request_quit){
    iron_usleep(100000);
    //load_available_con(&ctx);
  }

}
Exemplo n.º 3
0
TestConnectivity::TestConnectivity(QWidget *parent, ClusterConfiguration &conf) :
    QDialog(parent),
    ui(new Ui::TestConnectivity)
{
    ui->setupUi(this);
    this->doneButton = new QPushButton(tr("Done"));
    ui->buttonBox->addButton(this->doneButton, QDialogButtonBox::ActionRole);
    ui->buttonBox->setVisible(false);
    this->manager = ((ClusterManager*)(this->parent()))->manager;
    this->conf = conf;
    QMovie * tmpMovie;
    for(unsigned int i = 0 ; i < this->conf.hosts.size(); i++){
        ui->listWidget->addItem(new QListWidgetItem(tr(this->conf.hosts[i].c_str())));
        tmpMovie = new QMovie(QString(this->manager->adhash_home.c_str())+"/images/loading.gif");
        myMovies[tmpMovie] = i;
        connect(tmpMovie,SIGNAL(frameChanged(int)),this,SLOT(setButtonIcon(int)));
    }
    // if movie doesn't loop forever, force it to.
    for(map<QMovie*, int>::iterator i = myMovies.begin() ; i != myMovies.end(); i++){
        if (i->first->loopCount() != -1)
            connect(i->first,SIGNAL(finished()),i->first,SLOT(start()));
        i->first->start();
    }

    total = ui->listWidget->count();
    Worker * worker = new Worker(this);
    worker->moveToThread(&workerThread);
    connect(&workerThread, SIGNAL(finished()), worker, SLOT(deleteLater()));
    connect(this, SIGNAL(operate()), worker, SLOT(test_connections()));
    connect(worker, SIGNAL(host_connected(QMovie*)), this, SLOT(successful(QMovie*)));
    connect(worker, SIGNAL(host_disconnected(QMovie*)), this, SLOT(failed(QMovie*)));
    connect(this, SIGNAL(rejected()), &workerThread, SLOT(quit()));
    connect(doneButton, SIGNAL(clicked()), this, SLOT(accept()));
    workerThread.start();
    emit operate();
}