src/buffer_event.c

changeset 93
f0f5046ba1b0
parent 92
57662d96d8a8
parent 78
4782f315942f
child 96
570e309a8d3e
equal deleted inserted replaced
92:57662d96d8a8 93:f0f5046ba1b0
1 /* LuaEvent - Copyright (C) 2007 Thomas Harning <harningt@gmail.com> 1 /* LuaEvent - Copyright (C) 2007 Thomas Harning <harningt@gmail.com>
2 * Licensed as LGPL - See doc/COPYING for details */ 2 * Licensed as LGPL - See doc/COPYING for details */
3 #include "buffer_event.h" 3 #include "buffer_event.h"
4 #include "luaevent.h"
5 #include "utility.h" 4 #include "utility.h"
6 #include <lauxlib.h> 5 #include <lauxlib.h>
7 #include <malloc.h> 6 #include <malloc.h>
8 #include "event_buffer.h" 7 #include "event_buffer.h"
9 8
47 lua_pushvalue(L, -2); 46 lua_pushvalue(L, -2);
48 lua_remove(L, -3); 47 lua_remove(L, -3);
49 /* func, bufferevent */ 48 /* func, bufferevent */
50 lua_pushinteger(L, what); 49 lua_pushinteger(L, what);
51 /* What to do w/ errors...? */ 50 /* What to do w/ errors...? */
52 lua_pcall(L, 2, 0, 0); 51 if(!lua_pcall(L, 2, 0, 0))
52 {
53 /* FIXME: Perhaps luaevent users should be
54 * able to set an error handler? */
55 lua_pop(L, 1); /* Pop error message */
56 }
53 } 57 }
54 58
55 static void buffer_event_readcb(struct bufferevent *ev, void *ptr) { 59 static void buffer_event_readcb(struct bufferevent *ev, void *ptr) {
56 handle_callback((le_bufferevent*)ptr, EVBUFFER_READ, 1); 60 handle_callback((le_bufferevent*)ptr, EVBUFFER_READ, 1);
57 } 61 }

mercurial