Open Fractal147 opened 6 years ago
Good findings! I would prefer to keep the coroutine stuff visible in as few places as possible and maybe add another function to BufferedConnection. Maybe DirectSend which would first flush the old buffer and then send the new buffer. I also thought about automatically letting Send decide whether to fragment the new buffer or if it is long enough first flush the connection and then send the new (big) buffer. Let's say if a buffer of 900 bytes rolls in and we already have 300 bytes buffered then first send the 300 and then the 900 instead of chopping the 900 bytes apart.
That way also other applications that pump data could benefit.
@Fractal147 do you care to fix the merge conflicts and test? I will merge.
@marcoskirsch Err, I've completely forgotten about this! I'm still pretty new to github - what do you need me to do?
There is a built-in online conflict editor which is enough if the conflicts are simple.
Simple changes focussed on static file serving: Drops the req table when it's never used by the fileServeFunctions, (-static and -error) by setting it to nil. Uses the socket directly in the bulk of httpserver-static.lua to avoid using buffers. Will reduce amount sent per packet to 1024 bytes from 1400, but will save at least that amount of active memory, or probably more since buffer manipulation, etc. And makes bufferedConnection local, to prevent it being a global (to save memory - anything that uses it has a local copy anyway)