diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-09 14:53:19 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-09 14:53:19 +0000 |
commit | ab46b96db4d457e6a4f2e978c38b79762cdeb9d5 (patch) | |
tree | 01b9489ae9804ee45b765ad7045efee54b34347b /src/modules/extra | |
parent | f0680338833dd76966ba1769980abb9eafb50467 (diff) |
Move socket_ref and module_sockets vectors/arrays into InspIRCd*. These are public members, which InspSocket can modify.
(eventually, this will be marshalled safely through some accessors). When constructing an InspSocket you must now provide
an InspIRCd* instance to 'attach' the socket to.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4812 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra')
-rw-r--r-- | src/modules/extra/m_mysql.cpp | 10 | ||||
-rw-r--r-- | src/modules/extra/m_pgsql.cpp | 11 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 79baf170c..eeb803d5a 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -669,9 +669,9 @@ class Notifier : public InspSocket /* Create a socket on a random port. Let the tcp stack allocate us an available port */ #ifdef IPV6 - Notifier(Server* S) : InspSocket("::1", 0, true, 3000), Srv(S) + Notifier(InspIRCd* SI, Server* S) : InspSocket(SI, "::1", 0, true, 3000), Srv(S) #else - Notifier(Server* S) : InspSocket("127.0.0.1", 0, true, 3000), Srv(S) + Notifier(InspIRCd* SI, Server* S) : InspSocket(SI, "127.0.0.1", 0, true, 3000), Srv(S) #endif { uslen = sizeof(sock_us); @@ -681,7 +681,7 @@ class Notifier : public InspSocket } } - Notifier(int newfd, char* ip, Server* S) : InspSocket(newfd, ip), Srv(S) + Notifier(InspIRCd* SI, int newfd, char* ip, Server* S) : InspSocket(SI, newfd, ip), Srv(S) { log(DEBUG,"Constructor of new socket"); } @@ -699,7 +699,7 @@ class Notifier : public InspSocket virtual int OnIncomingConnection(int newsock, char* ip) { log(DEBUG,"Inbound connection on fd %d!",newsock); - Notifier* n = new Notifier(newsock, ip, Srv); + Notifier* n = new Notifier(this->Instance, newsock, ip, Srv); Srv->AddSocket(n); return true; } @@ -797,7 +797,7 @@ class ModuleSQL : public Module currid = 0; SQLModule = this; - MessagePipe = new Notifier(Srv); + MessagePipe = new Notifier(ServerInstance, Srv); Srv->AddSocket(MessagePipe); log(DEBUG,"Bound notifier to 127.0.0.1:%d",MessagePipe->GetPort()); diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 5d07c23b5..b9eb309db 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -44,7 +44,6 @@ * I can access the socket engine :\ */ extern InspIRCd* ServerInstance; -extern InspSocket* socket_ref[MAX_DESCRIPTORS]; extern time_t TIME; /* Forward declare, so we can have the typedef neatly at the top */ @@ -474,7 +473,7 @@ public: /* This class should only ever be created inside this module, using this constructor, so we don't have to worry about the default ones */ - SQLConn(ModulePgSQL* self, Server* srv, const SQLhost& hostinfo); + SQLConn(InspIRCd* SI, ModulePgSQL* self, Server* srv, const SQLhost& hostinfo); ~SQLConn(); @@ -663,8 +662,8 @@ public: } }; -SQLConn::SQLConn(ModulePgSQL* self, Server* srv, const SQLhost& hi) -: InspSocket::InspSocket(), us(self), Srv(srv), dbhost(hi.host), dbport(hi.port), dbname(hi.name), dbuser(hi.user), dbpass(hi.pass), ssl(hi.ssl), sql(NULL), status(CWRITE), qinprog(false) +SQLConn::SQLConn(InspIRCd* SI, ModulePgSQL* self, Server* srv, const SQLhost& hi) +: InspSocket::InspSocket(SI), us(self), Srv(srv), dbhost(hi.host), dbport(hi.port), dbname(hi.name), dbuser(hi.user), dbpass(hi.pass), ssl(hi.ssl), sql(NULL), status(CWRITE), qinprog(false) { log(DEBUG, "Creating new PgSQL connection to database %s on %s:%u (%s/%s)", dbname.c_str(), dbhost.c_str(), dbport, dbuser.c_str(), dbpass.c_str()); @@ -741,7 +740,7 @@ bool SQLConn::DoConnect() Close(); return false; } - socket_ref[this->fd] = this; + Instance->socket_ref[this->fd] = this; /* Socket all hooked into the engine, now to tell PgSQL to start connecting */ @@ -753,7 +752,7 @@ void SQLConn::Close() log(DEBUG,"SQLConn::Close"); if(this->fd > 01) - socket_ref[this->fd] = NULL; + Instance->socket_ref[this->fd] = NULL; this->fd = -1; this->state = I_ERROR; this->OnError(I_ERR_SOCKET); |