Coder Social home page Coder Social logo

luaevent's People

Contributors

audricschiltknecht avatar harningt avatar jprjr avatar jsnyder avatar mrothnet avatar mwild1 avatar robert-scheck avatar zash avatar zazzel avatar zeen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

luaevent's Issues

Fix Lua 5.3 compatibility

Lua 5.3 does not have lua_equal (neither did Lua 5.2), however the feature flag checks only for Lua 5.2.

Makefile should have separate targets for built files

Your all target currently unconditionally compiles everything everytime it is called, for example from the install target. This prevents build and install from being two different steps of the build process, which breaks some packaging tools for example.

A good solution for this problem would be to add targets for core.so depending on all .o files, and list it as a dependency for the all target, so if core.so is already present it won’t get built again.

Eventual stack overflow after many callbacks

Commit ced1f0d does not properly balance the Lua stack, and as a result values accumulate on every callback until Lua eventually throws a "stack overflow" error.

The actual stack limit depends on a compile-time macro in Lua, so it's hard to provide a decent test case. However the leak can be easily inspected by printing lua_gettop(L) within the luaevent_callback() function, and observing that it increases with every call.

I have a patch to fix the issue which I'll submit as a PR.

Treating 0 timeout the same as no timeout

When using the "return a new timeout" feature implemented in event_callback.c, timeouts of 0s are converted to a NULL timeout (which means block forever). This is inconsistent with the addevent code in luaevent.c, which allows you to set a 0s timeout.

This patch fixes the issue:

--- a/src/event_callback.c  2015-12-17 13:22:07.150902699 +0000
+++ b/src/event_callback.c  2015-12-17 13:22:22.966738099 +0000
@@ -52,8 +52,6 @@
        if( newEvent != event || (cb->timeout.tv_sec != new_tv.tv_sec || cb->timeout.tv_usec != new_tv.tv_usec) ) {
            struct timeval *ptv = &cb->timeout;
            cb->timeout = new_tv;
-           if(!cb->timeout.tv_sec && !cb->timeout.tv_usec)
-               ptv = NULL;
            event_del(ev);
            event_set(ev, fd, EV_PERSIST | newEvent, luaevent_callback, cb);
            /* Assume cannot set a new timeout.. */

LuaEvent is unaware of LuaSocket buffers

LuaSocket has an intermediate buffer for incoming data. When one calls conn:read(n), n bytes of data will be returned from this buffer, which is refilled from the underlying socket in 8k blocks (BUF_SIZE in buffer.h).

My guess is that this is to reduce the number of syscalls

However, because LuaEvent isn't aware of this buffer, this has the unfortunate side-effect that if you read less than BUF_SIZE, there may still be data left and no new read event will fire until new data comes in from the network.

A workaround is to always read everything, eg by :read()-ing "*a" or BUF_SIZE bytes.

Unable to install luaevent on Debian Bookworm with Lua 5.4

I'm encountering difficulties installing luaevent on Debian Bookworm with Lua 5.4. When attempting to install it using luarocks, I receive the following error message:

$ luarocks install luaevent
Error: No results matching query were found for Lua 5.4.

Client table in script leaks

In the luaevent.lua script file, there is an attempt to set the '__mode' attribute of to 'kv' in order to enable automatic collection for luaevent elements, however the syntax is wrong:

setmetatable({}, {'__mode', 'kv'})

should be

setmetatable({}, {__mode = 'kv'})

Upon review, this part of the system needs rework.

missing event.h

lauevent.h references event.h, which is not in this distribution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.