From 6cf3fc6b36e2046c36b729530117572ba44aafd7 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 2 Jun 2007 22:21:55 +0000 Subject: 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 --- include/socketengine_iocp.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'include/socketengine_iocp.h') 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; } -- cgit v1.2.3