diff options
-rw-r--r-- | include/inspircd.h | 2 | ||||
-rw-r--r-- | src/commands.cpp | 2 | ||||
-rw-r--r-- | src/dns.cpp | 11 | ||||
-rw-r--r-- | src/modules.cpp | 3 | ||||
-rw-r--r-- | src/socket.cpp | 14 | ||||
-rw-r--r-- | src/userprocess.cpp | 2 | ||||
-rw-r--r-- | src/users.cpp | 7 |
7 files changed, 20 insertions, 21 deletions
diff --git a/include/inspircd.h b/include/inspircd.h index 1d98ad610..9ed1b0468 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -43,6 +43,7 @@ #include "channels.h" #include "socket.h" #include "mode.h" +#include "socketengine.h" #include "command_parse.h" // some misc defines @@ -107,6 +108,7 @@ class InspIRCd time_t startup_time; ModeParser* ModeGrok; CommandParser* Parser; + SocketEngine* SE; std::string GetRevision(); std::string GetVersionString(); diff --git a/src/commands.cpp b/src/commands.cpp index 51b9ae3a3..a81214f3d 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -912,7 +912,7 @@ void handle_quit(char **parameters, int pcnt, userrec *user) /* push the socket on a stack of sockets due to be closed at the next opportunity */ if (user->fd > -1) { - SE->DelFd(user->fd); + ServerInstance->SE->DelFd(user->fd); if (find(local_users.begin(),local_users.end(),user) != local_users.end()) { log(DEBUG,"Delete local user"); diff --git a/src/dns.cpp b/src/dns.cpp index d8018656e..63322385a 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -36,10 +36,11 @@ using namespace std; #include <netinet/in.h> #include <arpa/inet.h> #include "dns.h" +#include "inspircd.h" #include "helperfuncs.h" #include "socketengine.h" -extern SocketEngine* SE; +extern InspIRCd* ServerInstance; extern ServerConfig* Config; serverstats* stats; @@ -668,7 +669,7 @@ bool DNS::ReverseLookup(std::string ip) } log(DEBUG,"DNS: ReverseLookup, fd=%d",this->myfd); #ifndef THREADED_DNS - SE->AddFd(this->myfd,true,X_ESTAB_DNS); + ServerInstance->SE->AddFd(this->myfd,true,X_ESTAB_DNS); #endif return true; } @@ -683,7 +684,7 @@ bool DNS::ForwardLookup(std::string host) } log(DEBUG,"DNS: ForwardLookup, fd=%d",this->myfd); #ifndef THREADED_DNS - SE->AddFd(this->myfd,true,X_ESTAB_DNS); + ServerInstance->SE->AddFd(this->myfd,true,X_ESTAB_DNS); #endif return true; } @@ -718,7 +719,7 @@ std::string DNS::GetResult() log(DEBUG,"DNS: GetResult()"); result = dns_getresult(this->myfd); #ifndef THREADED_DNS - SE->DelFd(this->myfd); + ServerInstance->SE->DelFd(this->myfd); #endif if (result) { stats->statsDnsGood++; @@ -742,7 +743,7 @@ std::string DNS::GetResultIP() if (this->myfd != -1) { #ifndef THREADED_DNS - SE->DelFd(this->myfd); + ServerInstance->SE->DelFd(this->myfd); #endif dns_close(this->myfd); } diff --git a/src/modules.cpp b/src/modules.cpp index 395f10f97..d3043a63e 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -51,7 +51,6 @@ using namespace std; #include "modules.h" #include "command_parse.h" -extern SocketEngine* SE; extern ServerConfig *Config; extern InspIRCd* ServerInstance; extern int MODCOUNT; @@ -603,7 +602,7 @@ bool Server::UserToPseudo(userrec* user,std::string message) user->fd = FD_MAGIC_NUMBER; user->ClearBuffer(); Write(old_fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,message.c_str()); - SE->DelFd(old_fd); + ServerInstance->SE->DelFd(old_fd); shutdown(old_fd,2); close(old_fd); return true; diff --git a/src/socket.cpp b/src/socket.cpp index 561435a2a..6d065e835 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -36,10 +36,8 @@ using namespace std; #include "helperfuncs.h" #include "socketengine.h" -extern SocketEngine* SE; -extern int boundPortCount; -extern int openSockfd[MAXSOCKS]; +extern InspIRCd* ServerInstance; extern time_t TIME; InspSocket* socket_ref[65535]; @@ -54,7 +52,7 @@ InspSocket::InspSocket(int newfd, char* ip) this->fd = newfd; this->state = I_CONNECTED; this->IP = ip; - SE->AddFd(this->fd,true,X_ESTAB_MODULE); + ServerInstance->SE->AddFd(this->fd,true,X_ESTAB_MODULE); socket_ref[this->fd] = this; } @@ -83,7 +81,7 @@ InspSocket::InspSocket(std::string host, int port, bool listening, unsigned long else { this->state = I_LISTENING; - SE->AddFd(this->fd,true,X_ESTAB_MODULE); + ServerInstance->SE->AddFd(this->fd,true,X_ESTAB_MODULE); socket_ref[this->fd] = this; log(DEBUG,"New socket now in I_LISTENING state"); return; @@ -131,7 +129,7 @@ InspSocket::InspSocket(std::string host, int port, bool listening, unsigned long } } this->state = I_CONNECTING; - SE->AddFd(this->fd,false,X_ESTAB_MODULE); + ServerInstance->SE->AddFd(this->fd,false,X_ESTAB_MODULE); socket_ref[this->fd] = this; return; } @@ -226,8 +224,8 @@ bool InspSocket::Poll() /* Our socket was in write-state, so delete it and re-add it * in read-state. */ - SE->DelFd(this->fd); - SE->AddFd(this->fd,true,X_ESTAB_MODULE); + ServerInstance->SE->DelFd(this->fd); + ServerInstance->SE->AddFd(this->fd,true,X_ESTAB_MODULE); return this->OnConnected(); break; case I_LISTENING: diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 837fc2b28..9c26eb343 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -70,7 +70,6 @@ extern time_t OLDTIME; extern std::vector<userrec*> local_users; extern InspIRCd* ServerInstance; -extern SocketEngine* SE; extern serverstats* stats; extern ServerConfig *Config; extern userrec* fd_ref_table[65536]; @@ -258,6 +257,7 @@ void ProcessUser(userrec* cu) bool DoBackgroundUserStuff(time_t TIME) { unsigned int numsockets = module_sockets.size(); + SocketEngine* SE = ServerInstance->SE; for (std::vector<InspSocket*>::iterator a = module_sockets.begin(); a < module_sockets.end(); a++) { InspSocket* s = (InspSocket*)*a; diff --git a/src/users.cpp b/src/users.cpp index 2ad0fd307..c311ffaf3 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -45,7 +45,6 @@ extern std::vector<InspSocket*> module_sockets; extern int MODCOUNT; extern InspSocket* socket_ref[65535]; extern time_t TIME; -extern SocketEngine* SE; extern userrec* fd_ref_table[65536]; extern serverstats* stats; extern ServerConfig *Config; @@ -381,7 +380,7 @@ void kill_link(userrec *user,const char* r) { IOHookModule->OnRawSocketClose(user->fd); } - SE->DelFd(user->fd); + ServerInstance->SE->DelFd(user->fd); user->CloseSocket(); } @@ -444,7 +443,7 @@ void kill_link_silent(userrec *user,const char* r) { IOHookModule->OnRawSocketClose(user->fd); } - SE->DelFd(user->fd); + ServerInstance->SE->DelFd(user->fd); user->CloseSocket(); } @@ -645,7 +644,7 @@ void AddClient(int socket, char* host, int port, bool iscached, char* ip) } fd_ref_table[socket] = clientlist[tempnick]; local_users.push_back(clientlist[tempnick]); - SE->AddFd(socket,true,X_ESTAB_CLIENT); + ServerInstance->SE->AddFd(socket,true,X_ESTAB_CLIENT); } void FullConnectUser(userrec* user) |