diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-02-07 20:30:22 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-02-07 20:30:22 +0000 |
commit | ff28bd5e88ed683f73022dcf10f00a67898536ed (patch) | |
tree | b9dc41bfdbc71da5c73c77697e4c0d13a25e5431 /src/common/socket.c | |
parent | ec70b501945e9c74c83a07f43ffc2c3a4cc97019 (diff) | |
download | hercules-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
Diffstat (limited to 'src/common/socket.c')
-rw-r--r-- | src/common/socket.c | 35 |
1 files changed, 1 insertions, 34 deletions
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)); |