Skip to content

LuaEvent is unaware of LuaSocket buffers #6

@Zash

Description

@Zash

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions