summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-04-09 01:39:46 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-04-09 01:39:46 +0000
commit0a8ee210f51d5871e2e0a9eb2af97aae7d755c63 (patch)
tree7177f2bb3b9887fe08f30231ad361868aa1c62b4 /src
parentfce3dab3045f8b7a9a79bd2957c0b3c7813d3d2f (diff)
downloadhercules-0a8ee210f51d5871e2e0a9eb2af97aae7d755c63.tar.gz
hercules-0a8ee210f51d5871e2e0a9eb2af97aae7d755c63.tar.bz2
hercules-0a8ee210f51d5871e2e0a9eb2af97aae7d755c63.tar.xz
hercules-0a8ee210f51d5871e2e0a9eb2af97aae7d755c63.zip
* Fixed memory corruption when amount of players online approached FD_SETSIZE (topic:262388, bugreport:4856, since r11897).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14781 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/common/socket.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/common/socket.c b/src/common/socket.c
index 425d84779..262351dcf 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -1351,9 +1351,6 @@ void send_shortlist_do_sends()
{
int i = 0;
- // Assume all or most of the fd's don't remain in the shortlist
- memset(send_shortlist_set, 0, sizeof(send_shortlist_set));
-
while( i < send_shortlist_count )
{
int fd = send_shortlist_array[i];
@@ -1375,7 +1372,6 @@ void send_shortlist_do_sends()
// be sent from it we'll keep it in the shortlist.
if( session[fd] && !session[fd]->flag.eof && session[fd]->wdata_size )
{
- send_shortlist_set[fd/32] |= 1<<(fd%32);
++i;
continue;
}
@@ -1383,6 +1379,7 @@ void send_shortlist_do_sends()
// Remove fd from shortlist, move the last fd to the current position
send_shortlist_array[i] = send_shortlist_array[--send_shortlist_count];
+ send_shortlist_set[fd/32]&=~(1<<(fd%32));
}
}
#endif