summaryrefslogtreecommitdiff
path: root/src/common/socket.h
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-12-17 13:23:34 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-12-17 13:23:34 +0000
commit3a4984a967675b1fd10c84730994bf08766c639d (patch)
tree00be3127a35d41ecbf1cb8f3b56922cd3575f36b /src/common/socket.h
parent1110866d367cb7a158e0b4c9dc2a16e15d3ca90d (diff)
downloadhercules-3a4984a967675b1fd10c84730994bf08766c639d.tar.gz
hercules-3a4984a967675b1fd10c84730994bf08766c639d.tar.bz2
hercules-3a4984a967675b1fd10c84730994bf08766c639d.tar.xz
hercules-3a4984a967675b1fd10c84730994bf08766c639d.zip
* Added flag.server to indicate interserver sockets
- replaces the previous way (setting 'client_addr' to 0) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11930 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 cdbac8f00..73322a206 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -35,7 +35,7 @@
#define RFIFOSPACE(fd) (session[fd]->max_rdata - session[fd]->rdata_size)
#define WFIFOSPACE(fd) (session[fd]->max_wdata - session[fd]->wdata_size)
-#define RFIFOREST(fd) (session[fd]->eof ? 0 : session[fd]->rdata_size - session[fd]->rdata_pos)
+#define RFIFOREST(fd) (session[fd]->flag.eof ? 0 : session[fd]->rdata_size - session[fd]->rdata_pos)
#define RFIFOFLUSH(fd) \
do { \
if(session[fd]->rdata_size == session[fd]->rdata_pos){ \
@@ -70,16 +70,19 @@ typedef int (*ParseFunc)(int fd);
struct socket_data
{
- unsigned char eof;
+ struct {
+ unsigned char eof : 1;
+ unsigned char server : 1;
+ } flag;
- unsigned char *rdata, *wdata;
+ uint32 client_addr; // remote client address
+
+ uint8 *rdata, *wdata;
size_t max_rdata, max_wdata;
size_t rdata_size, wdata_size;
size_t rdata_pos;
time_t rdata_tick; // time of last recv (for detecting timeouts); zero when timeout is disabled
- uint32 client_addr; // remote client address (0 for server connections)
-
RecvFunc func_recv;
SendFunc func_send;
ParseFunc func_parse;