void Thread::run()
{
  m_commandQueue = new CommandQueue(this);
  m_settings = new Settings();
  setCurrentProtocol("ftp");
  m_startupSem.release();
  
  // Enter the event loop
  QEventLoop eventLoop;
  while (!m_exit) {
    if (m_commandsDeferred)
      eventLoop.processEvents(QEventLoop::ProcessEventsFlag(QEventLoop::DeferredDeletion));
    else
      eventLoop.processEvents(QEventLoop::WaitForMoreEvents | QEventLoop::ProcessEventsFlag(QEventLoop::DeferredDeletion));
    
    if (m_commandsDeferred) {
      m_socket->nextCommand();
      m_commandsDeferred--;
    }
  }
  
  // Cleanup before exiting
  delete m_settings;
  delete m_commandQueue;
  
  foreach (Socket *socket, m_sockets) {
    delete socket;
  }

  // Schedule our deletion
  deleteLater();
}
Esempio n. 2
0
void Experiment::setCurrentProtocol(std::string protName) {
    mprintf("Setting protocol to %s", protName.c_str());
	if(protName.size() == 0) { return; }
    for(unsigned int i = 0; i < getList().size(); i++) {
        std::string comp = (getList()[i])->getName();
		
	    if(comp == protName){
            setCurrentProtocol(i);
            return;
        }
    }
    // if the name was never found print a warning
    mwarning(M_PARADIGM_MESSAGE_DOMAIN,
			 "Attempt to set Experiment to missing protocol -(%s)-", protName.c_str());
}
void Thread::setCurrentProtocol(const KUrl &url)
{
  setCurrentProtocol(url.protocol());
}