diff options
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; } |