Exemplo n.º 1
0
void CNetworkManager::StopServices()
{
  CLog::Log(LOGDEBUG, "NetworkManager: Stopping network services");
  StopServices(false);
  CLog::Log(LOGDEBUG, "NetworkManager: Waiting for network services to stop");
  StopServices(true);
}
Exemplo n.º 2
0
//截获KILL/PKILL信号
void catcher(int signo)
{
    //停止服务
    StopServices();
    trace_log(SYS, "Service Stopped.");
    exit(0);
}
Exemplo n.º 3
0
void CNetworkManager::NetworkMessage(EMESSAGE message, int param)
{
  switch( message )
  {
    case SERVICES_UP:
    {
      CLog::Log(LOGDEBUG, "%s - Starting network services",__FUNCTION__);
      StartServices();
    }
    break;
    case SERVICES_DOWN:
    {
      CLog::Log(LOGDEBUG, "%s - Signaling network services to stop",__FUNCTION__);
      StopServices(false); //tell network services to stop, but don't wait for them yet
      CLog::Log(LOGDEBUG, "%s - Waiting for network services to stop",__FUNCTION__);
      StopServices(true); //wait for network services to stop
    }
    break;
  }
}
Exemplo n.º 4
0
void CNetworkManager::OnConnectionStateChange(ConnectionState state)
{
  ConnectionState oldState = m_state;
  m_state = state;

  if (m_state != oldState)
    CLog::Log(LOGDEBUG, "NetworkManager: State changed to %s", ConnectionStateToString(m_state));

  if (oldState != NETWORK_CONNECTION_STATE_CONNECTED && m_state == NETWORK_CONNECTION_STATE_CONNECTED)
    StartServices();
  else if (oldState == NETWORK_CONNECTION_STATE_CONNECTED && oldState != m_state)
    StopServices();
}
Exemplo n.º 5
0
//服务控制
void WINAPI ControlHandler(DWORD request)
{
    switch (request)
    {
    case SERVICE_START:
        eServicRuning();            //启动端口服务
        break;

    case SERVICE_CONTROL_STOP:
    case SERVICE_CONTROL_SHUTDOWN:
        ServiceStatus.dwCurrentState = SERVICE_STOPPED;
        SetServiceStatus(hStatus, &ServiceStatus);
        StopServices();             //停止端口服务
        trace_log(LOG_BASE, "Service Stopped.");
        break;
    }
}