summaryrefslogtreecommitdiff
path: root/include/socketengine_iocp.h
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-06-02 22:21:55 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-06-02 22:21:55 +0000
commit6cf3fc6b36e2046c36b729530117572ba44aafd7 (patch)
tree5dba5db873d470d2fb1dd60d1a037dd3806c6a5d /include/socketengine_iocp.h
parent433837b847cd462b8fcf76da4b11772add35bf8e (diff)
Change the behaviour of insp in windows to keep its window open, with some status text in the title bar. It also clears the screen now on startup, see the wrapper for what a nasty amount of code it is to do such a simple thing to a windows console :(
Also, add somewhat of a hack to cut down on allocation time taken to map windows fd to a posix style fd in iocp engine. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7217 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/socketengine_iocp.h')
-rw-r--r--include/socketengine_iocp.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/include/socketengine_iocp.h b/include/socketengine_iocp.h
index 81563bc62..615c44fd7 100644
--- a/include/socketengine_iocp.h
+++ b/include/socketengine_iocp.h
@@ -58,12 +58,18 @@ class IOCPEngine : public SocketEngine
* in a future release.
* @return -1 if there are no free slots, and an integer if it finds one.
*/
- __inline int GenerateFd()
+ __inline int GenerateFd(int RealFd)
{
- register int i = 0;
- for(; i < MAX_DESCRIPTORS; ++i)
- if(ref[i] == 0)
- return i;
+ int index_hash = RealFd % MAX_DESCRIPTORS;
+ if(ref[index_hash] == 0)
+ return index_hash;
+ else
+ {
+ register int i = 0;
+ for(; i < MAX_DESCRIPTORS; ++i)
+ if(ref[i] == 0)
+ return i;
+ }
return -1;
}