aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer_event.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer_event.c')
-rw-r--r--src/buffer_event.c38
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}