diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-05-01 19:21:21 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-05-01 19:21:21 +0000 |
commit | a643172dd76776544773eeb4aa49b79a98ac5ca1 (patch) | |
tree | f9b2b8676cf90f48d4dd58cab519f442afb8ff68 /src/commands.cpp | |
parent | 4905b173f59f1e6a57b9b7d062bc2cfc3c4b45bf (diff) |
Added and tested fd crossreference table - improves speed a lot, and fixes one of the /STATS chars which has been broken a while
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1271 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/commands.cpp')
-rw-r--r-- | src/commands.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/commands.cpp b/src/commands.cpp index d66c21125..6fd516d99 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -197,6 +197,12 @@ extern file_cache RULES; extern address_cache IP; +// This table references users by file descriptor. +// its an array to make it VERY fast, as all lookups are referenced +// by an integer, meaning there is no need for a scan/search operation. +extern userrec* fd_ref_table[65536]; + + void handle_join(char **parameters, int pcnt, userrec *user) { chanrec* Ptr; @@ -391,6 +397,8 @@ void handle_kill(char **parameters, int pcnt, userrec *user) { purge_empty_chans(u); } + if (u->fd > -1) + fd_ref_table[u->fd] = NULL; delete u; } else @@ -940,6 +948,8 @@ void handle_quit(char **parameters, int pcnt, userrec *user) if (user->registered == 7) { purge_empty_chans(user); } + if (user->fd > -1) + fd_ref_table[user->fd] = NULL; delete user; } |