diff options
author | Thomas Harning Jr <harningt@gmail.com> | 2007-11-25 18:08:11 -0500 |
---|---|---|
committer | Thomas Harning Jr <harningt@gmail.com> | 2007-11-25 18:08:11 -0500 |
commit | fead5abe2ad7d185e3a2434d5e1695193339adf5 (patch) | |
tree | 0f4876e3069621452cf491573b7c420c18d27b3c /src | |
parent | d1943eda4282c598352916aeeb2f23c128d8fa90 (diff) | |
download | luaevent-prosody-fead5abe2ad7d185e3a2434d5e1695193339adf5.tar.gz luaevent-prosody-fead5abe2ad7d185e3a2434d5e1695193339adf5.zip |
bufferevent learned get_*_watermarks
Diffstat (limited to 'src')
-rw-r--r-- | src/buffer_event.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/buffer_event.c b/src/buffer_event.c index 5d74db2..e32fa04 100644 --- a/src/buffer_event.c +++ b/src/buffer_event.c @@ -167,11 +167,31 @@ 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 luaL_Reg buffer_event_funcs[] = { {"get_read", buffer_event_get_read}, {"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}, {NULL, NULL} }; |