summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lem/io.lua9
-rw-r--r--lem/io/core.c2
-rw-r--r--lem/io/stream.c6
3 files changed, 13 insertions, 4 deletions
diff --git a/lem/io.lua b/lem/io.lua
index 41d7732..26f4274 100644
--- a/lem/io.lua
+++ b/lem/io.lua
@@ -69,6 +69,15 @@ do
end
end
+if not io.Stream.cork then
+ function io.Stream:cork()
+ return nil, 'Operation not supported'
+ end
+ function io.Stream:uncork()
+ return nil, 'Operation not supported'
+ end
+end
+
do
local MultiServer = {}
MultiServer.__index = MultiServer
diff --git a/lem/io/core.c b/lem/io/core.c
index 6f7aa8b..b282583 100644
--- a/lem/io/core.c
+++ b/lem/io/core.c
@@ -322,12 +322,14 @@ luaopen_lem_io_core(lua_State *L)
/* mt.write = <stream_write> */
lua_pushcfunction(L, stream_write);
lua_setfield(L, -2, "write");
+#ifdef TCP_CORK
/* mt.cork = <stream_cork> */
lua_pushcfunction(L, stream_cork);
lua_setfield(L, -2, "cork");
/* mt.uncork = <stream_uncork> */
lua_pushcfunction(L, stream_uncork);
lua_setfield(L, -2, "uncork");
+#endif
/* mt.getpeer = <stream_getpeer> */
lua_pushcfunction(L, stream_getpeer);
lua_setfield(L, -2, "getpeer");
diff --git a/lem/io/stream.c b/lem/io/stream.c
index b2b8f00..07aa5d2 100644
--- a/lem/io/stream.c
+++ b/lem/io/stream.c
@@ -290,10 +290,7 @@ stream_write(lua_State *T)
return lua_yield(T, top);
}
-#ifndef TCP_CORK
-#define TCP_CORK TCP_NOPUSH
-#endif
-
+#ifdef TCP_CORK
static int
stream_setcork(lua_State *T, int state)
{
@@ -324,6 +321,7 @@ stream_uncork(lua_State *T)
{
return stream_setcork(T, 0);
}
+#endif
static int
stream_getpeer(lua_State *T)