changeset 5975:53e2c49cdaca draft

(svn r8673) -Codechange: use SetNonBlocking instead of implementing yet another version.
author rubidium <rubidium@openttd.org>
date Sun, 11 Feb 2007 13:39:23 +0000
parents a451868c6a26
children 93a644e6044b
files src/network/core/os_abstraction.h src/network/core/udp.cpp
diffstat 2 files changed, 3 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/network/core/os_abstraction.h
+++ b/src/network/core/os_abstraction.h
@@ -153,7 +153,7 @@
 #	endif
 #endif // __MORPHOS__ || __AMIGA__
 
-static inline bool SetNonBlocking(const int d)
+static inline bool SetNonBlocking(SOCKET d)
 {
 #ifdef WIN32
 	u_long nonblocking = 1;
@@ -167,7 +167,7 @@
 #endif
 }
 
-static inline bool SetNoDelay(const int d)
+static inline bool SetNoDelay(SOCKET d)
 {
 	/* XXX should this be done at all? */
 #if !defined(BEOS_NET_SERVER) // not implemented on BeOS net_server
--- a/src/network/core/udp.cpp
+++ b/src/network/core/udp.cpp
@@ -33,15 +33,7 @@
 		return false;
 	}
 
-	/* set nonblocking mode for socket */
-	{
-		unsigned long blocking = 1;
-#ifndef BEOS_NET_SERVER
-		ioctlsocket(this->sock, FIONBIO, &blocking);
-#else
-		setsockopt(this->sock, SOL_SOCKET, SO_NONBLOCK, &blocking, NULL);
-#endif
-	}
+	SetNonBlocking(this->sock);
 
 	sin.sin_family = AF_INET;
 	/* Listen on all IPs */