コード例 #1
0
bool
CClientApp::startClient()
{
    double retryTime;
    CScreen* clientScreen = NULL;
    try {
        if (s_clientScreen == NULL) {
            clientScreen = openClientScreen();
            s_client     = openClient(args().m_name,
                                      *args().m_serverAddress, clientScreen);
            s_clientScreen  = clientScreen;
            LOG((CLOG_NOTE "started client"));
        }

#if SYSAPI_WIN32 && GAME_DEVICE_SUPPORT
        if (args().m_gameDevice)
        {
            // TODO: currently this is failing because we're not
            // forcing compile with the DX XInput.h (so the win
            // SDK is being used)... we need to figure out how to
            // tell cmake to prefer the DX include path.
            LOG((CLOG_DEBUG "installing xinput hook"));
            InstallXInputHook();
        }
#endif

        s_client->connect();
        updateStatus();
        return true;
    }
    catch (XScreenUnavailable& e) {
        LOG((CLOG_WARN "secondary screen unavailable: %s", e.what()));
        closeClientScreen(clientScreen);
        updateStatus(CString("secondary screen unavailable: ") + e.what());
        retryTime = e.getRetryTime();
    }
    catch (XScreenOpenFailure& e) {
        LOG((CLOG_CRIT "failed to start client: %s", e.what()));
        closeClientScreen(clientScreen);
        return false;
    }
    catch (XBase& e) {
        LOG((CLOG_CRIT "failed to start client: %s", e.what()));
        closeClientScreen(clientScreen);
        return false;
    }

    if (args().m_restartable) {
        scheduleClientRestart(retryTime);
        return true;
    }
    else {
        // don't try again
        return false;
    }
}
コード例 #2
0
ファイル: ClientApp.cpp プロジェクト: TotoxLAncien/synergy
void
ClientApp::handleClientDisconnected(const Event&, void*)
{
	LOG((CLOG_NOTE "disconnected from server"));
	if (!args().m_restartable) {
		m_events->addEvent(Event(Event::kQuit));
	}
	else if (!m_suspended) {
		scheduleClientRestart(nextRestartTimeout());
	}
	updateStatus();
}
コード例 #3
0
ファイル: ClientApp.cpp プロジェクト: TotoxLAncien/synergy
bool
ClientApp::startClient()
{
	double retryTime;
	synergy::Screen* clientScreen = NULL;
	try {
		if (m_clientScreen == NULL) {
			clientScreen = openClientScreen();
			m_client     = openClient(args().m_name,
				*m_serverAddress, clientScreen);
			m_clientScreen  = clientScreen;
			LOG((CLOG_NOTE "started client"));
		}

		m_client->connect();

		updateStatus();
		return true;
	}
	catch (XScreenUnavailable& e) {
		LOG((CLOG_WARN "secondary screen unavailable: %s", e.what()));
		closeClientScreen(clientScreen);
		updateStatus(String("secondary screen unavailable: ") + e.what());
		retryTime = e.getRetryTime();
	}
	catch (XScreenOpenFailure& e) {
		LOG((CLOG_CRIT "failed to start client: %s", e.what()));
		closeClientScreen(clientScreen);
		return false;
	}
	catch (XBase& e) {
		LOG((CLOG_CRIT "failed to start client: %s", e.what()));
		closeClientScreen(clientScreen);
		return false;
	}

	if (args().m_restartable) {
		scheduleClientRestart(retryTime);
		return true;
	}
	else {
		// don't try again
		return false;
	}
}
コード例 #4
0
static
bool
startClient()
{
	double retryTime;
	CScreen* clientScreen = NULL;
	try {
		if (s_clientScreen == NULL) {
			clientScreen = openClientScreen();
			s_client     = openClient(ARG->m_name,
							*ARG->m_serverAddress, clientScreen);
			s_clientScreen  = clientScreen;
			LOG((CLOG_NOTE "started client"));
		}
		s_client->connect();
		updateStatus();
		return true;
	}
	catch (XScreenUnavailable& e) {
		LOG((CLOG_WARN "cannot open secondary screen: %s", e.what()));
		closeClientScreen(clientScreen);
		updateStatus(CString("Cannot open secondary screen: ") + e.what());
		retryTime = e.getRetryTime();
	}
	catch (XScreenOpenFailure& e) {
		LOG((CLOG_CRIT "cannot open secondary screen: %s", e.what()));
		closeClientScreen(clientScreen);
		return false;
	}
	catch (XBase& e) {
		LOG((CLOG_CRIT "failed to start client: %s", e.what()));
		closeClientScreen(clientScreen);
		return false;
	}

	if (ARG->m_restartable) {
		scheduleClientRestart(retryTime);
		return true;
	}
	else {
		// don't try again
		return false;
	}
}
コード例 #5
0
ファイル: ClientApp.cpp プロジェクト: TotoxLAncien/synergy
void
ClientApp::handleClientFailed(const Event& e, void*)
{
	Client::FailInfo* info =
		static_cast<Client::FailInfo*>(e.getData());

	updateStatus(String("Failed to connect to server: ") + info->m_what);
	if (!args().m_restartable || !info->m_retry) {
		LOG((CLOG_ERR "failed to connect to server: %s", info->m_what.c_str()));
		m_events->addEvent(Event(Event::kQuit));
	}
	else {
		LOG((CLOG_WARN "failed to connect to server: %s", info->m_what.c_str()));
		if (!m_suspended) {
			scheduleClientRestart(nextRestartTimeout());
		}
	}
	delete info;
}
コード例 #6
0
static
void
handleClientFailed(const CEvent& e, void*)
{
	CClient::CFailInfo* info =
		reinterpret_cast<CClient::CFailInfo*>(e.getData());

	updateStatus(CString("Failed to connect to server: ") + info->m_what);
	if (!ARG->m_restartable || !info->m_retry) {
		LOG((CLOG_ERR "failed to connect to server: %s", info->m_what));
		EVENTQUEUE->addEvent(CEvent(CEvent::kQuit));
	}
	else {
		LOG((CLOG_WARN "failed to connect to server: %s", info->m_what));
		if (!s_suspened) {
			scheduleClientRestart(nextRestartTimeout());
		}
	}
}