diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-01-16 01:53:45 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-01-16 01:53:45 +0000 |
commit | c7faf570a716329f0d0991cbb019a6fc5ed5b0de (patch) | |
tree | aee4b8acc3c5b71276b754136472103e4d158cbc /src/buffer_event.c | |
parent | 2ba1c9dd465a9d659198ac63fbc8cbd918f0d31e (diff) | |
parent | db628bce216e74a0f7507e614e9db5289ee972ee (diff) | |
download | luaevent-prosody-c7faf570a716329f0d0991cbb019a6fc5ed5b0de.tar.gz luaevent-prosody-c7faf570a716329f0d0991cbb019a6fc5ed5b0de.zip |
Merge with upstream
Diffstat (limited to 'src/buffer_event.c')
-rw-r--r-- | src/buffer_event.c | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/src/buffer_event.c b/src/buffer_event.c index e50e075..598230f 100644 --- a/src/buffer_event.c +++ b/src/buffer_event.c @@ -1,9 +1,9 @@ /* LuaEvent - Copyright (C) 2007 Thomas Harning <harningt@gmail.com> * Licensed as LGPL - See doc/COPYING for details */ +#include <stdlib.h> #include "buffer_event.h" #include "utility.h" #include <lauxlib.h> -#include <stdlib.h> #include "event_buffer.h" #define BUFFER_EVENT_MT "BUFFER_EVENT_MT" @@ -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,29 +165,10 @@ 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; } -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,15 +181,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; - - lua_pushinteger(L, ev->ev->timeout_read); - lua_pushinteger(L, ev->ev->timeout_write); - return 2; -} - static int buffer_event_enable(lua_State* L) { le_bufferevent* ev = buffer_event_get(L, 1); if(!ev->ev) return 0; @@ -231,10 +202,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} |