Jump to content
  • 0

Channel status is always Norm


cuceritorul28

Question

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분마다
    };
    DWORD tLCSUP = m_tLastChannelStatusUpdateTime+CHANNELSTATUS_UPDATE_PERIOD;
    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;
#endif        

        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 post

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 post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • 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.