mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 19:19:02 -04:00
Moved SocketEngine* SE into InspIRCd class
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2527 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
b593267ff1
commit
f5754cbc9c
@ -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();
|
||||
|
@ -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");
|
||||
|
11
src/dns.cpp
11
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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user