- }
- return 0;
-}
-
-ConnMap::iterator GetCharId(char id)
-{
- char i = 1;
- for (ConnMap::iterator iter = Connections.begin(); iter != Connections.end(); ++iter, ++i)
- {
- if (i == id)
- return iter;
- }
- return Connections.end();
-}
-
-void NotifyMainThread(SQLConnection* connection_with_new_result)
-{
- /* Here we write() to the socket the main thread has open
- * and we connect()ed back to before our thread became active.
- * The main thread is using a nonblocking socket tied into
- * the socket engine, so they wont block and they'll receive
- * nearly instant notification. Because we're in a seperate
- * thread, we can just use standard connect(), and we can
- * block if we like. We just send the connection id of the
- * connection back.
- *
- * NOTE: We only send a single char down the connection, this
- * way we know it wont get a partial read at the other end if
- * the system is especially congested (see bug #263).
- * The function FindCharId translates a connection name into a
- * one character id, and GetCharId translates a character id
- * back into an iterator.
- */
- char id = FindCharId(connection_with_new_result->GetID());
- send(QueueFD, &id, 1, 0);
-}
-
-void* DispatcherThread(void* arg);
-
-/** Used by m_mysql to notify one thread when the other has a result
- */
-class Notifier : public BufferedSocket
-{
- insp_sockaddr sock_us;
- socklen_t uslen;
-
-
- public:
-
- /* Create a socket on a random port. Let the tcp stack allocate us an available port */
-#ifdef IPV6
- Notifier(InspIRCd* SI) : BufferedSocket(SI, "::1", 0, true, 3000)
-#else
- Notifier(InspIRCd* SI) : BufferedSocket(SI, "127.0.0.1", 0, true, 3000)
-#endif
- {
- uslen = sizeof(sock_us);
- if (getsockname(this->fd,(sockaddr*)&sock_us,&uslen))