tightvnc/tvnserver-app/TvnServer.cpp
// Remark: this method can be called from other threads.
this method can be called from other threads.
this method can be called from other threads .
void TvnServer::onConfigReload(ServerConfig *serverConfig)
{
  {
    AutoLock l(&m_mutex);
    bool toggleMainRfbServer =
      m_srvConfig->isAcceptingRfbConnections() != (m_rfbServer != 0);
    bool changeMainRfbPort = m_rfbServer != 0 &&
      (m_srvConfig->getRfbPort() != (int)m_rfbServer->getBindPort());
    const TCHAR *bindHost =
      m_srvConfig->isOnlyLoopbackConnectionsAllowed() ? _T("localhost") : _T("0.0.0.0");
    bool changeBindHost =  m_rfbServer != 0 &&
      _tcscmp(m_rfbServer->getBindHost(), bindHost) != 0;
    if (toggleMainRfbServer ||
        changeMainRfbPort ||
        changeBindHost) {
      restartMainRfbServer();
    }
    (void)m_extraRfbServers.reload(m_runAsService, m_rfbClientManager);
  }
  {
    AutoLock l(&m_mutex);
    bool toggleHttp =
      m_srvConfig->isAcceptingHttpConnections() != (m_httpServer != 0);
    bool changePort = m_httpServer != 0 &&
      (m_srvConfig->getHttpPort() != (int)m_httpServer->getBindPort());
    if (toggleHttp || changePort) {
      restartHttpServer();
    }
  }
  changeLogProps();
}
void TvnServer :: onConfigReload ( ServerConfig * serverConfig ) { { AutoLock l ( & m_mutex ) ; bool toggleMainRfbServer = m_srvConfig -> isAcceptingRfbConnections ( ) != ( m_rfbServer != 0 ) ; bool changeMainRfbPort = m_rfbServer != 0 && ( m_srvConfig -> getRfbPort ( ) != ( int ) m_rfbServer -> getBindPort ( ) ) ; const TCHAR * bindHost = m_srvConfig -> isOnlyLoopbackConnectionsAllowed ( ) ? _T ( " " ) : _T ( " " ) ; bool changeBindHost = m_rfbServer != 0 && _tcscmp ( m_rfbServer -> getBindHost ( ) , bindHost ) != 0 ; if ( toggleMainRfbServer || changeMainRfbPort || changeBindHost ) { restartMainRfbServer ( ) ; } ( void ) m_extraRfbServers . reload ( m_runAsService , m_rfbClientManager ) ; } { AutoLock l ( & m_mutex ) ; bool toggleHttp = m_srvConfig -> isAcceptingHttpConnections ( ) != ( m_httpServer != 0 ) ; bool changePort = m_httpServer != 0 && ( m_srvConfig -> getHttpPort ( ) != ( int ) m_httpServer -> getBindPort ( ) ) ; if ( toggleHttp || changePort ) { restartHttpServer ( ) ; } } changeLogProps ( ) ; }
Remark: this method can be called from other threads.
Remark : this method can be called from other threads .
// Start/stop/restart RFB servers if needed. // FIXME: Protect only primitive operations. // FIXME: Nested lock in protected code (congifuration locking). // NOTE: ExtraRfbServers::reload() does not throw exceptions if some //       servers did not start. However, it returns false in that case. //       Here we ignore all errors. // Start/stop/restart HTTP server if needed. // FIXME: Protect only primitive operations.