diff options
author | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-05-09 03:18:16 +0000 |
---|---|---|
committer | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-05-09 03:18:16 +0000 |
commit | 290fb53feea76f9749e4630ec71552e41afa59de (patch) | |
tree | 9caf07f59c86716b5f4105d22b3cb65e89386cf2 /src/map | |
parent | 89b8b179b6864e5ce5d8b22a52feac761f66e77c (diff) | |
download | hercules-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/map')
-rw-r--r-- | src/map/chrif.c | 18 | ||||
-rw-r--r-- | src/map/clif.c | 22 | ||||
-rw-r--r-- | src/map/irc.c | 12 |
3 files changed, 26 insertions, 26 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c index d163dab77..3928c0a7a 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -1,12 +1,6 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <time.h> - #include "../common/cbasetypes.h" #include "../common/malloc.h" #include "../common/socket.h" @@ -16,13 +10,19 @@ #include "map.h" #include "battle.h" -#include "chrif.h" #include "clif.h" #include "intif.h" #include "npc.h" #include "pc.h" #include "status.h" #include "mercenary.h" +#include "chrif.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <time.h> struct dbt *auth_db; @@ -1424,7 +1424,7 @@ int chrif_parse(int fd) if (r == 1) continue; // intifで処理した if (r == 2) return 0; // intifで処理したが、データが足りない - session[fd]->eof = 1; + set_eof(fd); ShowWarning("chrif_parse: session #%d, intif_parse failed -> disconnected.\n", fd); return 0; } @@ -1465,7 +1465,7 @@ int chrif_parse(int fd) default: if (battle_config.error_log) ShowError("chrif_parse : unknown packet (session #%d): 0x%x. Disconnecting.\n", fd, cmd); - session[fd]->eof = 1; + set_eof(fd); return 0; } if (fd == char_fd) //There's the slight chance we lost the connection during parse, in which case this would segfault if not checked [Skotlex] diff --git a/src/map/clif.c b/src/map/clif.c index 15642ee62..ce70feaf9 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -4,12 +4,6 @@ #define DUMP_UNKNOWN_PACKET 0 #define DUMP_ALL_PACKETS 0 -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include <time.h> - #include "../common/cbasetypes.h" #include "../common/socket.h" #include "../common/timer.h" @@ -21,7 +15,6 @@ #include "map.h" #include "chrif.h" -#include "clif.h" #include "pc.h" #include "status.h" #include "npc.h" @@ -44,6 +37,13 @@ #include "mercenary.h" //[orn] #include "log.h" #include "irc.h" +#include "clif.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdarg.h> +#include <time.h> struct Clif_Config { int packet_db_ver; //Preferred packet version. @@ -1622,7 +1622,7 @@ void clif_quitsave(int fd,struct map_session_data *sd) */ static int clif_waitclose(int tid, unsigned int tick, int id, int data) { if (session[id] && session[id]->func_parse == clif_parse) //Avoid disconnecting non-players, as pointed out by End of Exam [Skotlex] - session[id]->eof = 1; + set_eof(id); return 0; } @@ -11873,7 +11873,7 @@ int clif_parse(int fd) packet_ver = sd->packet_ver; if (packet_ver < 0 || packet_ver > MAX_PACKET_VER) { // This should never happen unless we have some corrupted memory issues :X [Skotlex] ShowWarning("clif_parse: Disconnecting session #%d (AID:%d/CID:%d) for having invalid packet_ver=%d.", fd, sd->status.account_id, sd->status.char_id, packet_ver); - session[fd]->eof = 1; + set_eof(fd); return 0; } } else { @@ -11909,7 +11909,7 @@ int clif_parse(int fd) // ゲーム用以外パケットか、認証を終える前に0072以外が来たら、切断する if (cmd > MAX_PACKET_DB || packet_db[packet_ver][cmd].len == 0) { // if packet is not inside these values: session is incorrect?? or auth packet is unknown ShowWarning("clif_parse: Received unsupported packet (packet 0x%04x, %d bytes received), disconnecting session #%d.\n", cmd, RFIFOREST(fd), fd); - session[fd]->eof = 1; + set_eof(fd); return 0; } @@ -11922,7 +11922,7 @@ int clif_parse(int fd) packet_len = RFIFOW(fd,2); if (packet_len < 4 || packet_len > 32768) { ShowWarning("clif_parse: Packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n", cmd, packet_len, fd); - session[fd]->eof =1; + set_eof(fd); return 0; } } diff --git a/src/map/irc.c b/src/map/irc.c index b024137e0..1dab39903 100644 --- a/src/map/irc.c +++ b/src/map/irc.c @@ -1,10 +1,6 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - #include "../common/core.h" #include "../common/socket.h" #include "../common/malloc.h" @@ -18,8 +14,12 @@ #include "map.h" #include "pc.h" -#include "irc.h" #include "intif.h" //For GM Broadcast [Zido] +#include "irc.h" + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> short use_irc=0; @@ -252,7 +252,7 @@ void irc_parse_sub(int fd, char *incoming_string) sprintf(send_string, "QUIT"); irc_send(send_string); if(session[fd]) - session[fd]->eof=1; + set_eof(fd); } } else if (irc_si->state == 2){ |