diff options
author | shennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-01-04 03:09:36 +0000 |
---|---|---|
committer | shennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-01-04 03:09:36 +0000 |
commit | 3f205251d0846f9db5a72f931b4e2eaf67888af6 (patch) | |
tree | bbf9ec929e377d7211638d4204e90cc87b502a4d /src/char_sql | |
parent | 2c58d86f02271dca05f80b4aee02229b30a7f6db (diff) | |
download | hercules-3f205251d0846f9db5a72f931b4e2eaf67888af6.tar.gz hercules-3f205251d0846f9db5a72f931b4e2eaf67888af6.tar.bz2 hercules-3f205251d0846f9db5a72f931b4e2eaf67888af6.tar.xz hercules-3f205251d0846f9db5a72f931b4e2eaf67888af6.zip |
Made charserver refuse connections if no map server is connected, performance improvement. bugreport:2359
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15379 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql')
-rw-r--r-- | src/char_sql/char.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c index 99a6cc669..96d8d3549 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -1994,22 +1994,21 @@ int parse_fromlogin(int fd) ARR_FIND( 0, fd_max, i, session[i] && (sd = (struct char_session_data*)session[i]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2) ); if( i < fd_max ) { + int server_id; memcpy(sd->email, RFIFOP(fd,6), 40); sd->expiration_time = (time_t)RFIFOL(fd,46); sd->gmlevel = RFIFOB(fd,50); safestrncpy(sd->birthdate, (const char*)RFIFOP(fd,51), sizeof(sd->birthdate)); - + ARR_FIND( 0, ARRAYLENGTH(server), server_id, server[server_id].fd > 0 && server[server_id].map[0] ); // continued from char_auth_ok... - if( max_connect_user && count_users() >= max_connect_user && sd->gmlevel < gm_allow_level ) - { + if( server_id == ARRAYLENGTH(server) || //server not online, bugreport:2359 + ( max_connect_user && count_users() >= max_connect_user && sd->gmlevel < gm_allow_level ) ) { // refuse connection (over populated) WFIFOHEAD(i,3); WFIFOW(i,0) = 0x6c; WFIFOW(i,2) = 0; WFIFOSET(i,3); - } - else - { + } else { // send characters to player mmo_char_send006b(i, sd); #if PACKETVER >= 20110309 |