]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/dns.cpp
Changed m_messageflood to use PreMessage and PreNotice, because it may kick the user
[user/henk/code/inspircd.git] / src / dns.cpp
index 2d8fdeb65c06af66bbd4481503922017b749a33a..d9b3671d2cfc89dffb66c2f1c78cedafd04c9304 100644 (file)
@@ -42,6 +42,7 @@ using irc::sockets::insp_inaddr;
 using irc::sockets::insp_ntoa;
 using irc::sockets::insp_aton;
 using irc::sockets::OpenTCPSocket;
+using irc::sockets::NonBlocking;
 
 /** Masks to mask off the responses we get from the DNSRequest methods
  */
@@ -359,6 +360,7 @@ void DNS::Rehash()
        /* Initialize mastersocket */
        int s = OpenTCPSocket(ServerInstance->Config->DNSServer, SOCK_DGRAM);
        this->SetFd(s);
+       NonBlocking(s);
 
        /* Have we got a socket and is it nonblocking? */
        if (this->GetFd() != -1)
@@ -624,15 +626,11 @@ DNSResult DNS::GetResult()
 #endif
        const char* ipaddr_from;
        unsigned short int port_from = 0;
-#ifdef USING_IOCP
-       /** Dirty hack for IOCP UDP sockets **/
-       udp_overlap * ov = ((IOCPEngine*)ServerInstance->SE)->udp_ov;
-       memcpy(buffer, ov->udp_buffer, ov->udp_len);
-       memcpy(from, ov->udp_sockaddr, ov->udp_sockaddr_len);
-       int length = ov->udp_len;
-#else
-       int length = recvfrom(this->GetFd(),(char*)buffer,sizeof(DNSHeader),0,from,&x);
-#endif
+
+       void* m_readEvent = NULL;
+       GetExt("windows_readevent", m_readEvent);
+
+       int length = _recvfrom(this->GetFd(),(char*)buffer,sizeof(DNSHeader),0,from,&x);
 
        /* Did we get the whole header? */
        if (length < 12)
@@ -764,7 +762,7 @@ DNSResult DNS::GetResult()
                                 * as the last parameter on the line with a value ":1".
                                 */
                                if (*formatted == ':')
-                                       resultstr = "0" + resultstr;
+                                       resultstr.insert(0, "0");
                        }
                        break;