diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dns.cpp | 10 | ||||
-rw-r--r-- | src/socketengine_iocp.cpp | 7 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/dns.cpp b/src/dns.cpp index 2d8fdeb65..c3e909700 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -624,15 +624,7 @@ 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 + int length = _recvfrom(this->GetFd(),(char*)buffer,sizeof(DNSHeader),0,from,&x); /* Did we get the whole header? */ if (length < 12) diff --git a/src/socketengine_iocp.cpp b/src/socketengine_iocp.cpp index 8144c8be2..ff29716b7 100644 --- a/src/socketengine_iocp.cpp +++ b/src/socketengine_iocp.cpp @@ -349,6 +349,13 @@ int __getsockname(SOCKET s, sockaddr * name, int * namelen, void * acceptevent) return 0; } +int __recvfrom(SOCKET s, char * buf, int len, int flags, struct sockaddr * from, int * fromlen, udp_overlap * ov) +{ + memcpy(buf, ov->udp_buffer, ov->udp_len);
+ memcpy(from, ov->udp_sockaddr, *fromlen); + return ov->udp_len; +} + EventHandler * IOCPEngine::GetRef(int fd) { map<int, EventHandler*>::iterator itr = m_binding.find(fd); |