diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/mmo.h | 2 | ||||
-rw-r--r-- | src/common/socket.c | 12 | ||||
-rw-r--r-- | src/common/socket.h | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/common/mmo.h b/src/common/mmo.h index 92adf8af0..d39fe16e0 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -53,8 +53,6 @@ #define PACKETVER 20071106 #endif -#define FIFOSIZE_SERVERLINK 256*1024 - //Remove/Comment this line to disable sc_data saving. [Skotlex] #define ENABLE_SC_SAVING //Remove/Comment this line to disable server-side hot-key saving support [Skotlex] diff --git a/src/common/socket.c b/src/common/socket.c index 0111e9eed..0a576e517 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -543,18 +543,16 @@ static int create_session(int fd, RecvFunc func_recv, SendFunc func_send, ParseF return 0; } -static int delete_session(int fd) +static void delete_session(int fd) { - if (fd <= 0 || fd >= FD_SETSIZE) - return -1; - if (session[fd]) { + if( session_isValid(fd) ) + { aFree(session[fd]->rdata); aFree(session[fd]->wdata); aFree(session[fd]->session_data); aFree(session[fd]); session[fd] = NULL; } - return 0; } int realloc_fifo(int fd, unsigned int rfifo_size, unsigned int wfifo_size) @@ -1333,10 +1331,12 @@ void send_shortlist_add_fd(int fd) int i; int bit; - if( fd < 0 || fd >= FD_SETSIZE ) + if( !session_isValid(fd) ) return;// out of range + i = fd/32; bit = fd%32; + if( (send_shortlist_set[i]>>bit)&1 ) return;// already in the list diff --git a/src/common/socket.h b/src/common/socket.h index 0a740a63f..2f0ec6081 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -9,6 +9,7 @@ #endif #ifdef WIN32 + #define WIN32_LEAN_AND_MEAN // otherwise winsock2.h includes full windows.h #include <winsock2.h> typedef long in_addr_t; #else @@ -19,6 +20,7 @@ #include <time.h> +#define FIFOSIZE_SERVERLINK 256*1024 // socket I/O macros #define RFIFOHEAD(fd) |