summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-07 20:30:22 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-07 20:30:22 +0000
commitff28bd5e88ed683f73022dcf10f00a67898536ed (patch)
treeb9dc41bfdbc71da5c73c77697e4c0d13a25e5431
parentec70b501945e9c74c83a07f43ffc2c3a4cc97019 (diff)
downloadhercules-ff28bd5e88ed683f73022dcf10f00a67898536ed.tar.gz
hercules-ff28bd5e88ed683f73022dcf10f00a67898536ed.tar.bz2
hercules-ff28bd5e88ed683f73022dcf10f00a67898536ed.tar.xz
hercules-ff28bd5e88ed683f73022dcf10f00a67898536ed.zip
Wiped out the poorly written parse code from r2211
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9819 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--src/common/plugins.c1
-rw-r--r--src/common/socket.c35
-rw-r--r--src/common/socket.h17
4 files changed, 2 insertions, 52 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 0a4bc14b6..90d112e4c 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -7,6 +7,7 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
* Cleaning up of the socket code [ultramage]
- Shuffled includes around for files that were leeching off of socket.h
- Added code that enforces standard shutdown behavior for sockets
+ - Wiped out the poorly written parse code from r2211
* Removed old script bonuses bMatk, bMatk1, bMatk2.
* Fixed char-server not sending online notification when a party member
logs in.
diff --git a/src/common/plugins.c b/src/common/plugins.c
index ac8c4a7ee..2fa151a49 100644
--- a/src/common/plugins.c
+++ b/src/common/plugins.c
@@ -337,7 +337,6 @@ void plugins_init(void)
register_plugin_func(EVENT_ATHENA_FINAL);
// networking
- export_symbol(func_parse_table, SYMBOL_FUNC_PARSE_TABLE);
export_symbol(RFIFOSKIP, SYMBOL_RFIFOSKIP);
export_symbol(WFIFOSET, SYMBOL_WFIFOSET);
export_symbol(delete_session, SYMBOL_DELETE_SESSION);
diff --git a/src/common/socket.c b/src/common/socket.c
index dc7dbbca0..6063fcb77 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -282,7 +282,6 @@ static int connect_client(int listen_fd)
session[fd]->func_parse = (session[listen_fd]->func_parse) ? session[listen_fd]->func_parse : default_func_parse;
session[fd]->client_addr = client_address;
session[fd]->rdata_tick = last_tick;
- session[fd]->type = SESSION_UNKNOWN; // undefined type
//ShowMessage("new_session : %d %d\n",fd,session[fd]->eof);
return fd;
@@ -339,31 +338,6 @@ int make_listen_port(int port)
return make_listen_bind(INADDR_ANY,port);
}
-// function parse table
-// To-do: -- use dynamic arrays
-// -- add a register_parse_func();
-struct func_parse_table func_parse_table[SESSION_MAX];
-
-int default_func_check (struct socket_data *sd) { return 1; }
-
-void func_parse_check (struct socket_data *sd)
-{
- int i;
- for (i = SESSION_HTTP; i < SESSION_MAX; i++) {
- if (func_parse_table[i].func &&
- func_parse_table[i].check &&
- func_parse_table[i].check(sd) != 0)
- {
- sd->type = i;
- sd->func_parse = func_parse_table[i].func;
- return;
- }
- }
-
- // undefined -- treat as raw socket (using default parse)
- sd->type = SESSION_RAW;
-}
-
int make_connection(long ip,int port)
{
struct sockaddr_in server_address;
@@ -675,10 +649,7 @@ int do_parsepacket(void)
}
if(sd->rdata_size == 0 && sd->eof == 0)
continue;
- if(sd->func_parse){
- if(sd->type == SESSION_UNKNOWN)
- func_parse_check(sd);
- if(sd->type != SESSION_UNKNOWN)
+ if(sd->func_parse) {
sd->func_parse(i);
if(!session[i])
continue;
@@ -1201,10 +1172,6 @@ void socket_init(void)
session[0]->max_rdata = 2*rfifo_size;
session[0]->max_wdata = 2*wfifo_size;
- memset(func_parse_table, 0, sizeof(func_parse_table));
- func_parse_table[SESSION_RAW].check = default_func_check;
- func_parse_table[SESSION_RAW].func = default_func_parse;
-
#ifndef MINICORE
// Delete old connection history every 5 minutes
memset(connect_history, 0, sizeof(connect_history));
diff --git a/src/common/socket.h b/src/common/socket.h
index 65c18a5a6..7a07a3770 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -69,15 +69,6 @@
#define TOL(n) ((uint32)((n)&UINT32_MAX))
-// Session type
-enum SessionType {
- SESSION_UNKNOWN = -1,
- SESSION_RAW = 0,
- SESSION_HTTP = 1,
-//-----------------
- SESSION_MAX = 2
-};
-
// Struct declaration
struct socket_data {
@@ -93,15 +84,7 @@ struct socket_data {
int (*func_parse)(int);
void* session_data;
void* session_data2;
- enum SessionType type;
-};
-
-// Parse functions table
-struct func_parse_table {
- int (*func)(int);
- int (*check)(struct socket_data *);
};
-extern struct func_parse_table func_parse_table[SESSION_MAX];
// Data prototype declaration