summaryrefslogtreecommitdiff
path: root/src/common/socket.h
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-08 01:33:40 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-08 01:33:40 +0000
commit0a612a0a5a567605483b6401cbe0a2f7ee9133dc (patch)
treed98a01bb6aa98f213ea09e8ce4c8729cdab6ee98 /src/common/socket.h
parentc4dcc1a9106ce01cf02b0ffc32ab4498957ac390 (diff)
downloadhercules-0a612a0a5a567605483b6401cbe0a2f7ee9133dc.tar.gz
hercules-0a612a0a5a567605483b6401cbe0a2f7ee9133dc.tar.bz2
hercules-0a612a0a5a567605483b6401cbe0a2f7ee9133dc.tar.xz
hercules-0a612a0a5a567605483b6401cbe0a2f7ee9133dc.zip
* More aggressive cleaning up of the socket code
- removed unused session_data2 entry in sd - added a new create_session() function, helps keep things cleaner (although it's ad-hoc and not perfect, since this is C) - undid r4978 since it was getting in the way (re-add it if you need it) - added defines for the recv, send and parse func pointers - added null functions for the three actions, and made create_session() calls use those instead of NULL pointers; insignificant penalty and now: - since all three funcs are always initialized, removed all those NULL checks - removed the efd set, since as the people from the developernet forums pointed out, it's only for out-of-band data and NOT for error checking (in fact, select() bails out without giving any info if it errors out) - reorganized the randomly placed socket.c contents somewhat git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9822 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/socket.h')
-rw-r--r--src/common/socket.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/common/socket.h b/src/common/socket.h
index 7a07a3770..dc156318c 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -14,6 +14,7 @@
#endif
#include "../common/cbasetypes.h"
+#include <time.h>
// define declaration
@@ -70,6 +71,9 @@
// Struct declaration
+typedef int (*RecvFunc)(int fd);
+typedef int (*SendFunc)(int fd);
+typedef int (*ParseFunc)(int fd);
struct socket_data {
unsigned char eof;
@@ -79,11 +83,10 @@ struct socket_data {
size_t rdata_pos;
time_t rdata_tick;
struct sockaddr_in client_addr;
- int (*func_recv)(int);
- int (*func_send)(int);
- int (*func_parse)(int);
void* session_data;
- void* session_data2;
+ RecvFunc func_recv;
+ SendFunc func_send;
+ ParseFunc func_parse;
};
@@ -107,7 +110,7 @@ extern int session_isActive(int fd);
int make_listen_port(int);
int make_listen_bind(long,int);
int make_connection(long,int);
-int delete_session(int);
+int delete_session(int fd);
int realloc_fifo(int fd,unsigned int rfifo_size,unsigned int wfifo_size);
int realloc_writefifo(int fd, size_t addition);
int WFIFOSET(int fd,int len);