Jump to content
  • 0

Channel status is always Norm



Hello, i have a little problem with channel status, the problem comes from desc_client.cpp where, the function void CLIENT_DESC::UpdateChannelStatus(DWORD t, bool fForce) is not working properly. The function defines 4 states for the server, OFFLINE, NORM, BUSY and FULL. I parsed the variables into a syslog from the function and i realised that the iTotal it's always 0, so the server works in only 2 states, OFFLINE and NORM. Can anybody help me to fix this problem? I want to implement the count of players of the servers into the login interface. Another test i've made is with the command /who ingame, command which count properly the numbler of players.

Here is the function:

void CLIENT_DESC::UpdateChannelStatus(DWORD t, bool fForce)
    enum {
        // CHANNELSTATUS_UPDATE_PERIOD = 5*60*1000,    // 5분마다
        CHANNELSTATUS_UPDATE_PERIOD = 1*1000,    // 5분마다
    if (fForce || tLCSUP < t) {

        int iTotal;
        int * paiEmpireUserCount;
        int iLocal;
        DESC_MANAGER::instance().GetUserCount(iTotal, &paiEmpireUserCount, iLocal);
        TChannelStatus channelStatus;
        channelStatus.nPort = mother_port;
#if defined(__CHANNEL_STATUS_UPDATE__)
        channelStatus.player_count = iTotal;

        if (g_bNoMoreClient) channelStatus.bStatus = 0;
        else channelStatus.bStatus = iTotal > g_iFullUserCount ? 3 : iTotal > g_iBusyUserCount ? 2 : 1;
        sys_log(0, "Total %d , FullUserCount %d , BusyUserCount %d", iTotal, g_iFullUserCount, g_iBusyUserCount);
        DBPacket(HEADER_GD_UPDATE_CHANNELSTATUS, 0, &channelStatus, sizeof(channelStatus));
        m_tLastChannelStatusUpdateTime = t;

Link to comment
Share on other sites

  • Answers 3
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

3 answers to this question

Recommended Posts

  • 0

not the best solution, but you can try to get the number from query

		std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT COUNT(*) FROM player.player WHERE DATE_SUB(NOW(), INTERVAL 5 MINUTE) < last_play"));

		int count = 0;
		if ( pmsg->Get()->uiNumRows > 0 )
			MYSQL_ROW row = mysql_fetch_row(pmsg->Get()->pSQLResult);
			str_to_number(count, row[0]);


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Activity

    1. 43

      Upgraded Reference (TMP4 Base) By Ulthar

    2. 2

      TXT File To Lower Case [Phaselis Map Works]

    3. 43

      Upgraded Reference (TMP4 Base) By Ulthar

    4. 43

      Upgraded Reference (TMP4 Base) By Ulthar

    5. 5

      Official Environment Effect Options [REVERSED]

    6. 1

      4 Alternatives Open Source to Trello

  • Recently Browsing

    • No registered users viewing this page.
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.