summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshinomori <shinomori@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-04-03 15:53:04 +0000
committershinomori <shinomori@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-04-03 15:53:04 +0000
commit74362c7e51463fdc5008ea0ba9ebfb56b2e0994a (patch)
tree0027e5d34aa90fcf04a7a77111f2be4cc8ef4a18
parent922830421a2ac8c3ffa21fa64479801207a0bde0 (diff)
downloadhercules-74362c7e51463fdc5008ea0ba9ebfb56b2e0994a.tar.gz
hercules-74362c7e51463fdc5008ea0ba9ebfb56b2e0994a.tar.bz2
hercules-74362c7e51463fdc5008ea0ba9ebfb56b2e0994a.tar.xz
hercules-74362c7e51463fdc5008ea0ba9ebfb56b2e0994a.zip
integrating anti freeze system to server status update, should cure dropping server connections [Shinomori]
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1389 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-SVN.txt1
-rw-r--r--src/login/login.c5
-rw-r--r--src/login_sql/login.c20
-rw-r--r--src/map/chrif.c2
-rw-r--r--src/map/map.c8
5 files changed, 27 insertions, 9 deletions
diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt
index 1d8606166..3ba3e0f0f 100644
--- a/Changelog-SVN.txt
+++ b/Changelog-SVN.txt
@@ -2,6 +2,7 @@
Date Added
04/03
+ * integrating anti freeze system to status update [Shinomori]
* Fixed impossible drops at 0.01% chance [Lupus]
* Fixed some variable declarations in SQL login.c causing compilation errors [veider]
* Added NetBSD support into Makefile (Still lots of warrnings during compilation [veider]
diff --git a/src/login/login.c b/src/login/login.c
index 09c8cc606..d9858065e 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -1394,6 +1394,11 @@ int parse_fromchar(int fd) {
server[id].users = RFIFOL(fd,2);
if(anti_freeze_enable)
server_freezeflag[id] = 5; // Char anti-freeze system. Counter. 5 ok, 4...0 freezed
+
+ // send some answer
+ WFIFOW(fd,0) = 0x2718;
+ WFIFOSET(fd,2);
+
RFIFOSKIP(fd,6);
break;
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index 3e2c66e53..58432d037 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -789,16 +789,24 @@ int parse_fromchar(int fd){
return 0;
// how many users on world? (update)
if (server[id].users != RFIFOL(fd,2))
+ {
printf("set users %s : %d\n", server[id].name, RFIFOL(fd,2));
- server[id].users = RFIFOL(fd,2);
+
+ server[id].users = RFIFOL(fd,2);
+ sprintf(tmpsql,"UPDATE `sstatus` SET `user` = '%d' WHERE `index` = '%d'", server[id].users, id);
+ // query
+ if (mysql_query(&mysql_handle, tmpsql)) {
+ printf("DB server Error - %s\n", mysql_error(&mysql_handle));
+ }
+ }
+
if(anti_freeze_enable)
server_freezeflag[id] = 5; // Char anti-freeze system. Counter. 5 ok, 4...0 freezed
- sprintf(tmpsql,"UPDATE `sstatus` SET `user` = '%d' WHERE `index` = '%d'", server[id].users, id);
- // query
- if (mysql_query(&mysql_handle, tmpsql)) {
- printf("DB server Error - %s\n", mysql_error(&mysql_handle));
- }
+ // send some answer
+ WFIFOW(fd,0) = 0x2718;
+ WFIFOSET(fd,2);
+
RFIFOSKIP(fd,6);
break;
diff --git a/src/map/chrif.c b/src/map/chrif.c
index d23bf8b52..e250c8a18 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -1071,7 +1071,7 @@ int chrif_parse(int fd)
case 0x2afb: chrif_sendmapack(fd); break;
case 0x2afd: pc_authok(RFIFOL(fd,4), RFIFOL(fd,8), (time_t)RFIFOL(fd,12), (struct mmo_charstatus*)RFIFOP(fd,16)); break;
case 0x2afe: pc_authfail(RFIFOL(fd,2)); break;
- case 0x2b00: map_setusers(RFIFOL(fd,2)); break;
+ case 0x2b00: map_setusers(fd); break;
case 0x2b03: clif_charselectok(RFIFOL(fd,2)); break;
case 0x2b04: chrif_recvmap(fd); break;
case 0x2b06: chrif_changemapserverack(fd); break;
diff --git a/src/map/map.c b/src/map/map.c
index 7dd073f4b..902306ce8 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -180,8 +180,12 @@ int console = 0;
* (char鯖から送られてくる)
*------------------------------------------
*/
-void map_setusers(int n) {
- users = n;
+void map_setusers(int fd)
+{
+ users = RFIFOL(fd,2);
+ // send some anser
+ WFIFOW(fd,0) = 0x2718;
+ WFIFOSET(fd,2);
}
/*==========================================