summaryrefslogtreecommitdiff
path: root/src/char/char.c
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-05-09 03:18:16 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-05-09 03:18:16 +0000
commit290fb53feea76f9749e4630ec71552e41afa59de (patch)
tree9caf07f59c86716b5f4105d22b3cb65e89386cf2 /src/char/char.c
parent89b8b179b6864e5ce5d8b22a52feac761f66e77c (diff)
downloadhercules-290fb53feea76f9749e4630ec71552e41afa59de.tar.gz
hercules-290fb53feea76f9749e4630ec71552e41afa59de.tar.bz2
hercules-290fb53feea76f9749e4630ec71552e41afa59de.tar.xz
hercules-290fb53feea76f9749e4630ec71552e41afa59de.zip
* Added Buuyo-Tama's shortlist for send/eof sockets (defined out for now).
* Replaced toupper/tolower in ladmin by TOUPPER/TOLOWER defines. Shortlist: It's a list of sockets that have data to send and/or are ready for eof processing. It aims to reduce the amount of time spent on do_sendrecv, where it was spending ~13.5% of execution time on a server with 1k users at WoE. thanks to Buuyo-tama for the profile info and code git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10506 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char/char.c')
-rw-r--r--src/char/char.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/char/char.c b/src/char/char.c
index c4fc8dfda..c5ef5ce36 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -1,24 +1,6 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-#include <sys/types.h>
-
-#ifdef _WIN32
-#include <winsock2.h>
-#else
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#endif
-
-#include <time.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-
#include "../common/cbasetypes.h"
#include "../common/strlib.h"
#include "../common/core.h"
@@ -31,7 +13,6 @@
#include "../common/showmsg.h"
#include "../common/malloc.h"
-#include "char.h"
#include "inter.h"
#include "int_pet.h"
#include "int_homun.h"
@@ -41,6 +22,25 @@
#ifdef ENABLE_SC_SAVING
#include "int_status.h"
#endif
+#include "char.h"
+
+#include <sys/types.h>
+
+#ifdef WIN32
+#include <winsock2.h>
+#else
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#endif
+
+#include <time.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
#ifndef TXT_SQL_CONVERT
struct mmo_map_server{
@@ -1952,7 +1952,7 @@ int parse_tologin(int fd) {
// only login-server can have an access to here.
// so, if it isn't the login-server, we disconnect the session (fd != login_fd).
if (fd != login_fd)
- session[fd]->eof = 1;
+ set_eof(fd);
if(session[fd]->eof) {
if (fd == login_fd) {
ShowWarning("Connection to login-server lost (connection #%d).\n", fd);
@@ -2455,7 +2455,7 @@ int parse_tologin(int fd) {
}
default:
ShowWarning("Unknown packet 0x%04x received from login-server, disconnecting.\n", RFIFOW(fd,0));
- session[fd]->eof = 1;
+ set_eof(fd);
return 0;
}
}
@@ -2664,7 +2664,7 @@ int parse_frommap(int fd)
if (server_fd[id] == fd)
break;
if(id==MAX_MAP_SERVERS)
- session[fd]->eof=1;
+ set_eof(fd);
if(session[fd]->eof){
if (id < MAX_MAP_SERVERS) {
unsigned char buf[16384];
@@ -3241,7 +3241,7 @@ int parse_frommap(int fd)
}
// inter server処理でもない場合は切断
ShowError("Unknown packet 0x%04x from map server, disconnecting.\n", RFIFOW(fd,0));
- session[fd]->eof = 1;
+ set_eof(fd);
return 0;
}
}
@@ -3307,7 +3307,7 @@ int parse_char(int fd)
sd = (struct char_session_data*)session[fd]->session_data;
if(login_fd < 0)
- session[fd]->eof = 1;
+ set_eof(fd);
if(session[fd]->eof) { // disconnect any player (already connected to char-server or coming back from map-server) if login-server is diconnected.
if (fd == login_fd)
login_fd = -1;
@@ -3755,7 +3755,7 @@ int parse_char(int fd)
}
case 0x7532: // disconnect(default also disconnect)
default:
- session[fd]->eof = 1;
+ set_eof(fd);
return 0;
}
}