* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * InspIRCd: (C) 2002-2008 InspIRCd Development Team
* See: http://www.inspircd.org/wiki/index.php/Credits
*
* This program is free but copyrighted software; see
/* $CompileFlags: exec("mysql_config --include") */
/* $LinkerFlags: exec("mysql_config --libs_r") rpath("mysql_config --libs_r") */
/* $ModDep: m_sqlv2.h */
+/* $NoPedantic */
/* THE NONBLOCKING MYSQL API!
*
int rows;
public:
- MySQLresult(Module* self, Module* to, MYSQL_RES* res, int affected_rows, unsigned int id) : SQLresult(self, to, id), currentrow(0), fieldmap(NULL)
+ MySQLresult(Module* self, Module* to, MYSQL_RES* res, int affected_rows, unsigned int rid) : SQLresult(self, to, rid), currentrow(0), fieldmap(NULL)
{
/* A number of affected rows from from mysql_affected_rows.
*/
}
}
- MySQLresult(Module* self, Module* to, SQLerror e, unsigned int id) : SQLresult(self, to, id), currentrow(0)
+ MySQLresult(Module* self, Module* to, SQLerror e, unsigned int rid) : SQLresult(self, to, rid), currentrow(0)
{
rows = 0;
error = e;
{
if (!HostInConf(conf, i->second->GetConfHost()))
{
- DELETE(i->second);
+ delete i->second;
safei = i;
--i;
Connections.erase(safei);
while ((i = Connections.begin()) != Connections.end())
{
Connections.erase(i);
- DELETE(i->second);
+ delete i->second;
}
}
/** Used by m_mysql to notify one thread when the other has a result
*/
-class Notifier : public InspSocket
+class Notifier : public BufferedSocket
{
insp_sockaddr sock_us;
socklen_t uslen;
/* Create a socket on a random port. Let the tcp stack allocate us an available port */
#ifdef IPV6
- Notifier(InspIRCd* SI) : InspSocket(SI, "::1", 0, true, 3000)
+ Notifier(InspIRCd* SI) : BufferedSocket(SI, "::1", 0, true, 3000)
#else
- Notifier(InspIRCd* SI) : InspSocket(SI, "127.0.0.1", 0, true, 3000)
+ Notifier(InspIRCd* SI) : BufferedSocket(SI, "127.0.0.1", 0, true, 3000)
#endif
{
uslen = sizeof(sock_us);
}
}
- Notifier(InspIRCd* SI, int newfd, char* ip) : InspSocket(SI, newfd, ip)
+ Notifier(InspIRCd* SI, int newfd, char* ip) : BufferedSocket(SI, newfd, ip)
{
}
}
ServerInstance->Modules->PublishInterface("SQL", this);
+ Implementation eventlist[] = { I_OnRehash, I_OnRequest };
+ ServerInstance->Modules->Attach(eventlist, this, 2);
}
virtual ~ModuleSQL()
}
- void Implements(char* List)
- {
- List[I_OnRehash] = List[I_OnRequest] = 1;
- }
unsigned long NewID()
{
return ++currid;
}
- char* OnRequest(Request* request)
+ virtual const char* OnRequest(Request* request)
{
if(strcmp(SQLREQID, request->GetId()) == 0)
{
/* XXX: Unlock */
}
- usleep(50);
+ usleep(1000);
}
return NULL;
}
-MODULE_INIT(ModuleSQL);
+MODULE_INIT(ModuleSQL)