summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-02 17:08:09 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-02 17:08:09 +0000
commit2db77cda56947d4ee0f913c8082f6607855ca713 (patch)
treef7f83c80f62adc4e3eb0f9f3b680229466c4352e /include
parentd9d33e7246baf59241d083eb2c253e729390d205 (diff)
Automatic detection and allocation of max fds. No longer needs recompile to change, just adjust it in your kernel or whatever and restart insp.
Please note that select and iocp socket engines do not support detection and are always set to FD_SETSIZE and 10240 descriptors respectively. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9263 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/modules.h6
-rw-r--r--include/socketengine.h4
-rw-r--r--include/socketengines/socketengine_epoll.h2
-rw-r--r--include/socketengines/socketengine_kqueue.h2
-rw-r--r--include/socketengines/socketengine_ports.h2
-rw-r--r--include/socketengines/socketengine_select.h2
6 files changed, 8 insertions, 10 deletions
diff --git a/include/modules.h b/include/modules.h
index ce6e3fa21..efb9113aa 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -230,13 +230,9 @@ do { \
#define FD_MAGIC_NUMBER -42
/* Useful macros */
-#ifdef WINDOWS
+
/** Is a local user */
#define IS_LOCAL(x) ((x->GetFd() > -1))
-#else
-/** Is a local user */
-#define IS_LOCAL(x) ((x->GetFd() > -1) && (x->GetFd() <= MAX_DESCRIPTORS))
-#endif
/** Is a remote user */
#define IS_REMOTE(x) (x->GetFd() < 0)
/** Is a module created user */
diff --git a/include/socketengine.h b/include/socketengine.h
index 3acc7bd4f..f647f4df3 100644
--- a/include/socketengine.h
+++ b/include/socketengine.h
@@ -167,7 +167,9 @@ protected:
int CurrentSetSize;
/** Reference table, contains all current handlers
*/
- EventHandler* ref[MAX_DESCRIPTORS];
+ EventHandler** ref;
+
+ int MAX_DESCRIPTORS;
public:
double TotalEvents;
diff --git a/include/socketengines/socketengine_epoll.h b/include/socketengines/socketengine_epoll.h
index 87829582a..07d0e3621 100644
--- a/include/socketengines/socketengine_epoll.h
+++ b/include/socketengines/socketengine_epoll.h
@@ -33,7 +33,7 @@ class EPollEngine : public SocketEngine
private:
/** These are used by epoll() to hold socket events
*/
- struct epoll_event events[MAX_DESCRIPTORS];
+ struct epoll_event* events;
public:
/** Create a new EPollEngine
* @param Instance The creator of this object
diff --git a/include/socketengines/socketengine_kqueue.h b/include/socketengines/socketengine_kqueue.h
index 7ef24085a..49b51590a 100644
--- a/include/socketengines/socketengine_kqueue.h
+++ b/include/socketengines/socketengine_kqueue.h
@@ -34,7 +34,7 @@ class KQueueEngine : public SocketEngine
private:
/** These are used by kqueue() to hold socket events
*/
- struct kevent ke_list[MAX_DESCRIPTORS];
+ struct kevent* ke_list;
/** This is a specialised time value used by kqueue()
*/
struct timespec ts;
diff --git a/include/socketengines/socketengine_ports.h b/include/socketengines/socketengine_ports.h
index d055912e5..519eaad8b 100644
--- a/include/socketengines/socketengine_ports.h
+++ b/include/socketengines/socketengine_ports.h
@@ -36,7 +36,7 @@ class PortsEngine : public SocketEngine
private:
/** These are used by epoll() to hold socket events
*/
- port_event_t events[MAX_DESCRIPTORS];
+ port_event_t* events;
public:
/** Create a new PortsEngine
* @param Instance The creator of this object
diff --git a/include/socketengines/socketengine_select.h b/include/socketengines/socketengine_select.h
index 83d92d48f..3540c0944 100644
--- a/include/socketengines/socketengine_select.h
+++ b/include/socketengines/socketengine_select.h
@@ -37,7 +37,7 @@ private:
std::map<int,int> fds;
/** List of writeable ones (WantWrite())
*/
- bool writeable[MAX_DESCRIPTORS];
+ bool* writeable;
/** The read set and write set, populated before each call to select().
*/
fd_set wfdset, rfdset, errfdset;