Ejemplo n.º 1
0
TvnServer::~TvnServer()
{
  Configurator::getInstance()->removeListener(this);

  stopControlServer();
  stopHttpServer();
  m_extraRfbServers.shutDown();
  stopMainRfbServer();

  ZombieKiller *zombieKiller = ZombieKiller::getInstance();

  zombieKiller->killAllZombies();

  m_rfbClientManager->removeListener(this);

  delete m_rfbClientManager;

  delete zombieKiller;

  Log::info(_T("Shutdown WinSock"));

  try {
    WindowsSocket::cleanup();
  } catch (Exception &ex) {
    Log::error(_T("%s"), ex.getMessage());
  }

  delete Configurator::getInstance();
}
Ejemplo n.º 2
0
//--------------------------------------------------------------
void ccwServer::mouseReleased(int x, int y, int button){
	if (httpPortChanged && httpIsRunning) { // indicates the port slider updated
		httpPortChanged = false;
		stopHttpServer();
		startHttpServer();
	}
	else if (webGuiPortChanged && webGuiIsRunning) {
		webGuiPortChanged = false;
		stopWebGuiServer();
		startWebGuiServer();
	}
}
Ejemplo n.º 3
0
void TvnServer::restartHttpServer()
{

  stopHttpServer();

  if (m_config->isAcceptingHttpConnections()) {
    Log::message(_T("Starting HTTP server"));
    try {
      m_httpServer = new HttpServer(_T("0.0.0.0"), m_config->getHttpPort(), m_runAsService);
    } catch (Exception &ex) {
      Log::error(_T("Failed to start HTTP server: \"%s\""), ex.getMessage());
    }
  }
}
Ejemplo n.º 4
0
// ======================================= Set the port
void ccwServer::setHttpPort(unsigned int newPort)
{
	bool httpWasRunning = httpIsRunning;
	
	#ifndef TARGET_OSX // we dont have these buttons on macosx version
		b_http80->setValue(false);
		b_http888->setValue(false);
	#endif
	
	b_http8080->setValue(false);
	
	if (httpIsRunning) stopHttpServer();
	
	httpSettings.port = newPort;
	s_httpPort->setValue(newPort);
	
	if (httpWasRunning) startHttpServer();
}
Ejemplo n.º 5
0
// ======================================= Called when an action is performed on the UI
void ccwServer::handleGui(int parameterId, int task, void* data, int length)
{
	bool httpWasRunning = httpIsRunning;
	
	switch(parameterId)
	{
		case uiStartStop:
			if (httpIsRunning) 
			{
				stopHttpServer();
				ofSetWindowTitle("CCW [Stopped]");
			}
			else 
			{
				startHttpServer();
			}
			break;
			
		case uiMySQLStartStop:
			if (mySQLIsRunning)
			{
				stopMySQLServer();
			} 
			else startMySQLServer();
			break;
			
		case uiWebGuiStartStop:
			if (webGuiIsRunning)
			{
				stopWebGuiServer();
			} 
			else startWebGuiServer();
			break;
			
		case uiPort80:
			setHttpPort(80);
			b_http80->setValue(true);
			break;
			
		case uiPort888:
			setHttpPort(888);
			b_http888->setValue(true);
			break;
			
		case uiPort8080:
			setHttpPort(8080);
			b_http8080->setValue(true);
			break;
			
		case uiAutoRun:
			if (httpSettings.autoRun) 
			{
				httpSettings.autoRun = false;
				b_autoRun->setValue(false);
				setupFile.setValue("autorun", "false", 0);
			}
			else 
			{
				httpSettings.autoRun = true;
				b_autoRun->setValue(true);
				setupFile.setValue("autorun", "true", 0);
			}
			setupFile.saveFile(PATH_TO_CONFIG);
			break;
			
		case uiLog: //TODO are they written seperately?
			if (httpIsRunning) stopHttpServer();
			
			if (httpSettings.logEnabled) 
			{
				httpSettings.logEnabled = false;
				b_log->setValue(false);
				setupFile.setValue("logging", "false", 0);
			}
			else 
			{	
				httpSettings.logEnabled = true;
				b_log->setValue(true);
				setupFile.setValue("logging", "true", 0);
			}
			
			if (httpWasRunning) startHttpServer();
			
			setupFile.saveFile(PATH_TO_CONFIG);
			break;
			
		case uiDirList:
			if (httpIsRunning) stopHttpServer();
			
			if (httpSettings.dirListEnabled) 
			{
				httpSettings.dirListEnabled = false;
				b_dirList->setValue(false);
				setupFile.setValue("dirlist", "false", 0);
			}
			else 
			{
				httpSettings.dirListEnabled = true;
				b_dirList->setValue(true);
				setupFile.setValue("dirlist", "true", 0);
			}
			
			if (httpWasRunning) startHttpServer();
			
			setupFile.saveFile(PATH_TO_CONFIG);
			
			break;
			
		case uiPort:
			httpSettings.port = s_httpPort->mValue;
			httpPortChanged = true;
			break;
			
		case uiWebGuiPort:
			webGuiPort = s_webGuiPort->mValue;
			webGuiPortChanged = true;
			break;
	}
}