aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-01-16 01:53:45 +0000
committerMatthew Wild <mwild1@gmail.com>2012-01-16 01:53:45 +0000
commitc7faf570a716329f0d0991cbb019a6fc5ed5b0de (patch)
treeaee4b8acc3c5b71276b754136472103e4d158cbc
parent2ba1c9dd465a9d659198ac63fbc8cbd918f0d31e (diff)
parentdb628bce216e74a0f7507e614e9db5289ee972ee (diff)
downloadluaevent-prosody-c7faf570a716329f0d0991cbb019a6fc5ed5b0de.tar.gz
luaevent-prosody-c7faf570a716329f0d0991cbb019a6fc5ed5b0de.zip
Merge with upstream
-rw-r--r--CHANGELOG10
-rw-r--r--Makefile41
-rw-r--r--README29
-rw-r--r--doc/modules/luaevent.core.bufferevent.mdwn12
-rw-r--r--lua/luaevent.lua4
-rw-r--r--src/buffer_event.c38
-rw-r--r--src/event_buffer.c3
7 files changed, 52 insertions, 85 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 366eaca..c295d76 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,13 @@
+0.3.2 - 2011-07-06
+ * Fixed recorded version in Lua
+0.3.1 - 2011-01-15
+ * Merged all of luaevent-prosody (0.1.1) changes (missed updates)
+0.3.0 - 2011-01-15
+ * Fixed libevent 2.0 compilation errors
+ * Merged all of luaevent-prosody (0.1.0) changes
+ * Removes low-level read access to watermark & timeout values that break API
+ * Switches to watermark write accessor function to avoid API break
+======
luaevent-prosody 0.1.1 - 2010-02-25
* Fix overflow with high event timeouts
======
diff --git a/Makefile b/Makefile
index be58b48..611d705 100644
--- a/Makefile
+++ b/Makefile
@@ -1,32 +1,49 @@
+.PHONY: all install clean dist dist-all dist-bzip2 dist-gzip dist-zip
+
+DIST_DIR=dist
+
# Utilities
INSTALL = install
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 644
# Flags
-CFLAGS = -O2 -c -Wall -fpic
+CFLAGS = -Wall -fpic
LDFLAGS = -shared
# Directories
-LUA_INC_DIR=/usr/include/lua5.1
-LUA_LIB_DIR=/usr/lib
+LUA_INC_DIR ?= /usr/include/lua5.1
-INSTALL_DIR_LUA=/usr/share/lua/5.1
-INSTALL_DIR_BIN=/usr/lib/lua/5.1
+INSTALL_DIR_LUA ?= /usr/share/lua/5.1
+INSTALL_DIR_BIN ?= /usr/lib/lua/5.1
# Files
-LUA_LIB = lua5.1
LIB = core.so
all:
- $(CC) $(CFLAGS) -Iinclude -I$(LUA_INC_DIR) src/*.c
- $(CC) $(LDFLAGS) -o $(LIB) *.o -L$(LUA_LIB_DIR) -l$(LUA_LIB) -levent
+ $(CC) $(CFLAGS) -c -Iinclude -I$(LUA_INC_DIR) src/*.c
+ $(CC) $(LDFLAGS) -o $(LIB) *.o -levent
+
+dist dist-all: distdir dist-bzip2 dist-gzip dist-zip
+
+distdir:
+ mkdir -p $(DIST_DIR)
+
+VERSION=luaevent-$(shell git describe --abbrev=4 HEAD 2>/dev/null)
+dist-bzip2: distdir
+ git archive --format=tar --prefix=$(VERSION)/ HEAD | bzip2 -9v > $(DIST_DIR)/$(VERSION).tar.bz2
+dist-gzip: distdir
+ git archive --format=tar --prefix=$(VERSION)/ HEAD | gzip -9v > $(DIST_DIR)/$(VERSION).tar.gz
+dist-zip: distdir
+ git archive --format=zip --prefix=$(VERSION)/ HEAD > $(DIST_DIR)/$(VERSION).zip
install: all
- $(INSTALL_DATA) -D lua/luaevent.lua $(DESTDIR)$(INSTALL_DIR_LUA)/luaevent.lua
- $(INSTALL_PROGRAM) -D $(LIB) $(DESTDIR)$(INSTALL_DIR_BIN)/luaevent/$(LIB)
+ mkdir -p $(DESTDIR)$(INSTALL_DIR_LUA)
+ $(INSTALL_DATA) lua/luaevent.lua $(DESTDIR)$(INSTALL_DIR_LUA)/luaevent.lua
+ mkdir -p $(DESTDIR)$(INSTALL_DIR_BIN)/luaevent/
+ $(INSTALL_PROGRAM) $(LIB) $(DESTDIR)$(INSTALL_DIR_BIN)/luaevent/$(LIB)
clean:
- rm *.so
- rm *.o
+ rm -f *.so
+ rm -f *.o
diff --git a/README b/README
index 1e00aec..6612408 100644
--- a/README
+++ b/README
@@ -1,41 +1,26 @@
-luaevent-prosody is a (hopefully temporary) fork of the luaevent library. This fork is
-maintained by Matthew Wild <mwild1@gmail.com>.
-
-Source repository: http://code.matthewwild.co.uk/luaevent-prosody
-
-This luaevent-prosody 0.1.1 release is based on luaevent 0.2.0. See CHANGELOG for more
-information about the changes.
-
-NOTE: This version of luaevent-prosody depends on the *1.4* branch of libevent - 1.3 can
- link but will produce erratic behaviour at runtime. I intend to look into this,
- but don't have time right now - patches welcome.
-
-=== Original README from luaevent 0.2.0 ===
-
Description: This is a binding of libevent to Lua. It will serve as a drop-in replacement
for copas, and eventually support more features (async DNS, HTTP, RPC...).
Contact information:
Lead: Thomas Harning <harningt@gmail.com>
+Major contributions from prosody project:
+ Matthew Wild: mwild1@gmail.com
+
+
Project page: http://luaforge.net/projects/luaevent/
GIT Repositories:
- git://repo.or.cz/luaevent.git
- http://repo.or.cz/r/luaevent.git
-Try checking it out and working on it, the 'mob' feature is enabled so you can commit w/:
-git push git+ssh://mob@repo.or.cz/srv/git/luaevent.git master:mob
+ See: https://github.com/harningt/luaevent
Build Requirements:
- premake (>= 3.3 < 4)
- libevent (recommend >= 1.3b)
+ libevent (recommend >= 1.4)
Usage Requirements:
- libevent (recommend >= 1.3b)
+ libevent (recommend >= 1.4)
LuaSocket
See test/ directory for examples of usage.
Dependencies:
- premake - http://premake.sourceforge.net/download
libevent - http://monkey.org/~provos/libevent/
LuaSocket - http://www.cs.princeton.edu/~diego/professional/luasocket/
diff --git a/doc/modules/luaevent.core.bufferevent.mdwn b/doc/modules/luaevent.core.bufferevent.mdwn
index 842ee06..5115bb8 100644
--- a/doc/modules/luaevent.core.bufferevent.mdwn
+++ b/doc/modules/luaevent.core.bufferevent.mdwn
@@ -43,24 +43,12 @@ Functions:
* `low` - When buffer is below this, the event will be fired
* `high` - N/A to libevent, user app may use this
-## bufferevent:get_read_watermarks
-* Output: `low, high`
-* See `set_read_watermarks`
-
-## bufferevent:get_write_watermarks
-* Output: `low, high`
-* See `set_write_watermarks`
-
## bufferevent:set_timeouts
* Sets timeouts for the bufferevent's events
* Input: `(read, write)`
* `read` - Read readiness timeout
* `write` - Write readiness timeout
-## bufferevent:get_timeouts
-* Output: `read, write`
-* See `set_timeouts`
-
## bufferevent:enable/disable
* Input: `event flag`
* `event flag` - `EV_READ`, `EV_WRITE`, or `EV_READ|EV_WRITE`
diff --git a/lua/luaevent.lua b/lua/luaevent.lua
index 7e1b9ad..509d94f 100644
--- a/lua/luaevent.lua
+++ b/lua/luaevent.lua
@@ -5,8 +5,8 @@
module("luaevent", package.seeall)
require("luaevent.core")
-_NAME = "luaevent-prosody";
-_VERSION = "0.1.0";
+_NAME = "luaevent";
+_VERSION = "0.3.2";
local EV_READ = luaevent.core.EV_READ
local EV_WRITE = luaevent.core.EV_WRITE
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}
diff --git a/src/event_buffer.c b/src/event_buffer.c
index 823d738..a61c643 100644
--- a/src/event_buffer.c
+++ b/src/event_buffer.c
@@ -1,9 +1,8 @@
/* LuaEvent - Copyright (C) 2007 Thomas Harning <harningt@gmail.com>
* Licensed as LGPL - See doc/COPYING for details */
-
+#include <stdlib.h>
#include "event_buffer.h"
#include <lauxlib.h>
-#include <stdlib.h>
#define EVENT_BUFFER_MT "EVENT_BUFFER_MT"