summaryrefslogtreecommitdiff
path: root/src/common/socket.c
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-01-31 12:39:54 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-01-31 12:39:54 +0000
commit7d014932d263c908529db8ad3d7b48a7ea01d0ec (patch)
tree068f1cb446328f4e6b80f39067490d2fc87578b9 /src/common/socket.c
parent748d2dbd9c453603ebf8968c9a747372b530da33 (diff)
downloadhercules-7d014932d263c908529db8ad3d7b48a7ea01d0ec.tar.gz
hercules-7d014932d263c908529db8ad3d7b48a7ea01d0ec.tar.bz2
hercules-7d014932d263c908529db8ad3d7b48a7ea01d0ec.tar.xz
hercules-7d014932d263c908529db8ad3d7b48a7ea01d0ec.zip
* Various accumulated cleanups and fixes.
- Improved the compile speed for files which include common/socket.h on windows builds (related r10471). - Moved FIFOSIZE_SERVERLINK define from common/mmo.h to common/socket.h (since it is a server connection FIFO size setting). - Fixed script command 'areamobuseskill' canceling monster's skill cast before it determined it's new target, which could be 'none' (bugreport:3272, since r13897). - Added a protection against attempts to read an empty backup / write to a full backup in skill_dance_switch as per TODO from r11347. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14690 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/socket.c')
-rw-r--r--src/common/socket.c12
1 files changed, 6 insertions, 6 deletions
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