summaryrefslogtreecommitdiff
path: root/src/network/core/os_abstraction.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-05-01 13:29:40 +0000
committerrubidium <rubidium@openttd.org>2011-05-01 13:29:40 +0000
commit99ec3a044aab32e0fe4aea03a5539cf0e4f129e9 (patch)
tree8d9cdc4b81d2d7c4a9ca505656b837777e38092a /src/network/core/os_abstraction.h
parent536c581923e456ed6a0d1a47747b7c9e111d8755 (diff)
downloadopenttd-99ec3a044aab32e0fe4aea03a5539cf0e4f129e9.tar.xz
(svn r22403) -Document: some more network/core code
Diffstat (limited to 'src/network/core/os_abstraction.h')
-rw-r--r--src/network/core/os_abstraction.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/network/core/os_abstraction.h b/src/network/core/os_abstraction.h
index 1bdf942c6..133f3d958 100644
--- a/src/network/core/os_abstraction.h
+++ b/src/network/core/os_abstraction.h
@@ -279,6 +279,11 @@ typedef unsigned long in_addr_t;
# endif
#endif /* __MORPHOS__ || __AMIGA__ */
+/**
+ * Try to set the socket into non-blocking mode.
+ * @param d The socket to set the non-blocking more for.
+ * @return True if setting the non-blocking mode succeeded, otherwise false.
+ */
static inline bool SetNonBlocking(SOCKET d)
{
#ifdef WIN32
@@ -293,6 +298,11 @@ static inline bool SetNonBlocking(SOCKET d)
#endif
}
+/**
+ * Try to set the socket to not delay sending.
+ * @param d The socket to disable the delaying for.
+ * @return True if disabling the delaying succeeded, otherwise false.
+ */
static inline bool SetNoDelay(SOCKET d)
{
/* XXX should this be done at all? */
@@ -306,8 +316,8 @@ static inline bool SetNoDelay(SOCKET d)
}
/* Make sure these structures have the size we expect them to be */
-assert_compile(sizeof(in_addr) == 4);
-assert_compile(sizeof(in6_addr) == 16);
+assert_compile(sizeof(in_addr) == 4); ///< IPv4 addresses should be 4 bytes.
+assert_compile(sizeof(in6_addr) == 16); ///< IPv6 addresses should be 16 bytes.
#endif /* ENABLE_NETWORK */