From f5754cbc9c77387adafc6c58b5d46ffa9b5facd3 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 16 Dec 2005 12:32:01 +0000 Subject: Moved SocketEngine* SE into InspIRCd class git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2527 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/commands.cpp | 2 +- src/dns.cpp | 11 ++++++----- src/modules.cpp | 3 +-- src/socket.cpp | 14 ++++++-------- src/userprocess.cpp | 2 +- src/users.cpp | 7 +++---- 6 files changed, 18 insertions(+), 21 deletions(-) (limited to 'src') 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 #include #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 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::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 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) -- cgit v1.2.3