diff options
author | Thomas Harning Jr <harningt@gmail.com> | 2007-11-25 18:19:58 -0500 |
---|---|---|
committer | Thomas Harning Jr <harningt@gmail.com> | 2007-11-25 18:19:58 -0500 |
commit | 9cab6a19d118d480a3a9827f2839fceb5dd607ed (patch) | |
tree | 1754e08e13f19ef9e23cb034e5f55b8af147348a | |
parent | 8d922b9f096b384fefb0b62f04a493515a9c582e (diff) | |
download | luaevent-prosody-9cab6a19d118d480a3a9827f2839fceb5dd607ed.tar.gz luaevent-prosody-9cab6a19d118d480a3a9827f2839fceb5dd607ed.zip |
bufferevent learned enable/disable
-rw-r--r-- | src/buffer_event.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/buffer_event.c b/src/buffer_event.c index 3cb0296..a2ec577 100644 --- a/src/buffer_event.c +++ b/src/buffer_event.c @@ -206,6 +206,22 @@ static int buffer_event_get_timeouts(lua_State* L) { return 2; } +static int buffer_event_enable(lua_State* L) { + le_bufferevent* ev = buffer_event_get(L, 1); + if(!ev->ev) return 0; + + lua_pushinteger(L, bufferevent_enable(ev->ev, luaL_checkinteger(L, 2))); + return 1; +} + +static int buffer_event_disable(lua_State* L) { + le_bufferevent* ev = buffer_event_get(L, 1); + if(!ev->ev) return 0; + + lua_pushinteger(L, bufferevent_disable(ev->ev, luaL_checkinteger(L, 2))); + return 1; +} + static luaL_Reg buffer_event_funcs[] = { {"get_read", buffer_event_get_read}, {"get_write", buffer_event_get_write}, @@ -215,6 +231,8 @@ static luaL_Reg buffer_event_funcs[] = { {"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} }; |