diff options
author | burlex <burlex@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-06-14 22:00:17 +0000 |
---|---|---|
committer | burlex <burlex@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-06-14 22:00:17 +0000 |
commit | 7d4edd5ac3987ff1161a5152e3aa19c8a0a8260a (patch) | |
tree | 80220eb63f9617793ef55ef7abed21d4965238fe /src | |
parent | 2b293ebe7586687df2df9c87eb1b05697b4d318a (diff) |
- Made the recvfrom wrapper a bit neater.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7314 e03df62e-2008-0410-955e-edbf42e46eb7
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); |