From d1c516f4beb47e79fb886e46a4b6e0cf432d850a Mon Sep 17 00:00:00 2001 From: James Snyder Date: Wed, 3 Mar 2010 18:19:20 -0600 Subject: Changes to compile on OS X. - BSD version of install doesn't have -D flag - stdlib.h should include malloc defs (malloc.h is obsolete) --- src/buffer_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/buffer_event.c') diff --git a/src/buffer_event.c b/src/buffer_event.c index deb1963..70b726c 100644 --- a/src/buffer_event.c +++ b/src/buffer_event.c @@ -1,9 +1,9 @@ /* LuaEvent - Copyright (C) 2007 Thomas Harning * Licensed as LGPL - See doc/COPYING for details */ +#include #include "buffer_event.h" #include "utility.h" #include -#include #include "event_buffer.h" #define BUFFER_EVENT_MT "BUFFER_EVENT_MT" -- cgit v1.2.3 From 24cac1c1bcf4b0dc3188f72934d2881692829e61 Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Sat, 15 Jan 2011 19:46:55 -0500 Subject: bufferevent compiler-flag fix regarding >= 2.0 ... must rebuild between 1.4 and 2.0 version builds --- src/buffer_event.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/buffer_event.c') diff --git a/src/buffer_event.c b/src/buffer_event.c index 4e20353..7f1ab9b 100644 --- a/src/buffer_event.c +++ b/src/buffer_event.c @@ -201,8 +201,13 @@ static int buffer_event_get_timeouts(lua_State* L) { le_bufferevent* ev = buffer_event_get(L, 1); if(!ev->ev) return 0; +#if LIBEVENT_VERSION_NUMBER >= 0x02000000 + lua_pushinteger(L, (ev->ev->timeout_read).tv_sec); + lua_pushinteger(L, (ev->ev->timeout_write).tv_sec); +#else lua_pushinteger(L, ev->ev->timeout_read); lua_pushinteger(L, ev->ev->timeout_write); +#endif return 2; } -- cgit v1.2.3 From 01e03565ef64b4e6970bf502dd6bb2f248e90b53 Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Sat, 15 Jan 2011 20:11:54 -0500 Subject: bufferevent unlearns read access to low-level timeout/watermark properties that appear shouldn't be exposed --- src/buffer_event.c | 35 ----------------------------------- 1 file changed, 35 deletions(-) (limited to 'src/buffer_event.c') diff --git a/src/buffer_event.c b/src/buffer_event.c index 0aab636..debc54a 100644 --- a/src/buffer_event.c +++ b/src/buffer_event.c @@ -171,24 +171,6 @@ static int buffer_event_set_write_watermarks(lua_State* L) { return 0; } -static int buffer_event_get_read_watermarks(lua_State* L) { - le_bufferevent* ev = buffer_event_get(L, 1); - if(!ev->ev) return 0; - - lua_pushinteger(L, ev->ev->wm_read.low); - lua_pushinteger(L, ev->ev->wm_read.high); - return 2; -} - -static int buffer_event_get_write_watermarks(lua_State* L) { - le_bufferevent* ev = buffer_event_get(L, 1); - if(!ev->ev) return 0; - - lua_pushinteger(L, ev->ev->wm_write.low); - lua_pushinteger(L, ev->ev->wm_write.high); - return 2; -} - static int buffer_event_set_timeouts(lua_State* L) { int timeout_read, timeout_write; le_bufferevent* ev = buffer_event_get(L, 1); @@ -201,20 +183,6 @@ static int buffer_event_set_timeouts(lua_State* L) { return 0; } -static int buffer_event_get_timeouts(lua_State* L) { - le_bufferevent* ev = buffer_event_get(L, 1); - if(!ev->ev) return 0; - -#if LIBEVENT_VERSION_NUMBER >= 0x02000000 - lua_pushinteger(L, (ev->ev->timeout_read).tv_sec); - lua_pushinteger(L, (ev->ev->timeout_write).tv_sec); -#else - lua_pushinteger(L, ev->ev->timeout_read); - lua_pushinteger(L, ev->ev->timeout_write); -#endif - return 2; -} - static int buffer_event_enable(lua_State* L) { le_bufferevent* ev = buffer_event_get(L, 1); if(!ev->ev) return 0; @@ -236,10 +204,7 @@ static luaL_Reg buffer_event_funcs[] = { {"get_write", buffer_event_get_write}, {"set_read_watermarks", buffer_event_set_read_watermarks}, {"set_write_watermarks", buffer_event_set_write_watermarks}, - {"get_read_watermarks", buffer_event_get_read_watermarks}, - {"get_write_watermarks", buffer_event_get_write_watermarks}, {"set_timeouts", buffer_event_set_timeouts}, - {"get_timeouts", buffer_event_get_timeouts}, {"enable", buffer_event_enable}, {"disable", buffer_event_disable}, {NULL, NULL} -- cgit v1.2.3 From 90abc074b2f911f9afc6e321f17fcc0c8570fb95 Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Sat, 15 Jan 2011 20:12:24 -0500 Subject: bufferevent learns to set watermarking using write-accessor functions rather than low-level access --- src/buffer_event.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/buffer_event.c') diff --git a/src/buffer_event.c b/src/buffer_event.c index debc54a..8a663bc 100644 --- a/src/buffer_event.c +++ b/src/buffer_event.c @@ -153,8 +153,7 @@ static int buffer_event_set_read_watermarks(lua_State* L) { low = lua_tonumber(L, 2); high = lua_tonumber(L, 3); - ev->ev->wm_read.low = low; - ev->ev->wm_read.high = high; + bufferevent_setwatermark(ev->ev, EV_READ, low, high); return 0; } @@ -166,8 +165,7 @@ static int buffer_event_set_write_watermarks(lua_State* L) { low = lua_tonumber(L, 2); high = lua_tonumber(L, 3); - ev->ev->wm_write.low = low; - ev->ev->wm_write.high = high; + bufferevent_setwatermark(ev->ev, EV_WRITE, low, high); return 0; } -- cgit v1.2.3