Kim Alvefur
8a2e65d5b7
util.poll: Rename things to clarify poll(2) limits
...
With epoll(7), MAX_EVENTS controls how many events can be retrieved in one
epoll_wait call, while with poll(2) this MAX_WATCHED controls how many
sockets or other FDs can be watched at once.
2023-11-27 08:19:52 +01:00
Kim Alvefur
da38e2af42
util.poll: Quadruple number of events retrieved at once from epoll
...
Better performance under load maybe?
See b890ceb1c24f for previous increase
2023-11-21 20:45:56 +01:00
Kim Alvefur
c8e2129a82
util.poll: Return early if given zero timeout and no pending events
...
Should have been part of f33887f925e1 to ensure it won't skip processing
timers at all when very busy.
2023-11-21 17:43:46 +01:00
Kim Alvefur
8136aa749a
util: Add compat for prosody module name change to C sources
2023-03-17 18:03:07 +01:00
Kim Alvefur
bf35a39a15
util.poll: Include unistd.h only for epoll
...
This defines close(), which is only used with epoll, hence we don't need
to include it when building in poll or select mode.
2023-02-10 00:37:05 +01:00
Kim Alvefur
dff4beae02
util-src: Remove Lua 5.1 compat macros
...
Part of #1600
2022-07-01 21:21:21 +02:00
Kim Alvefur
af95bb77e6
util.poll: Add support for the poll() API
...
Might be better than select(), more portable than epoll.
2022-02-23 20:31:03 +01:00
Kim Alvefur
04aa101da3
util.poll: Expose API (epoll or select) used
...
Could he handy to know for debugging or decisions
2022-02-27 14:36:43 +01:00
Kim Alvefur
22d734e305
util.poll: Restructure to make adding additional system APIs easier
2022-02-23 20:30:22 +01:00
Kim Alvefur
625ec0a93f
util-src: Use the luaL_pushfail API added in Lua 5.4 to highlight all failure conditions
...
Actually just an alias of pushnil, but it does make it more obvious
where the failure conditions are, which is good for readability.
2020-06-07 02:25:56 +02:00
Kim Alvefur
d8ab361f15
util.poll: Add missing return statements in fallback mode
...
These allowed modifying or deleting select() state for unregistered FDs.
During normal usage this should never happen. Modifying one that isn't
set might cause weirdness but deleting an already deleted FD isn't a
problem.
2019-07-28 16:17:23 +02:00
Kim Alvefur
b8f3a149da
util.poll: Minimize scope of methods
...
File scope is enough
2019-04-13 23:55:34 +02:00
Kim Alvefur
2bb3772374
net.server_epoll: Special handling of signal interrupts
2018-10-12 03:22:09 +02:00
Kim Alvefur
afeb1f6f02
net.server_epoll: Ignore ENOENT when deregitering socket
...
It should not really happen
2018-10-12 03:21:11 +02:00
Kim Alvefur
bbf669b2c5
net.server_epoll: Graceful handling of registering already added socket
2018-10-12 03:20:09 +02:00
Kim Alvefur
f26390b484
util.poll: Fix inverted logic
2018-10-11 18:56:11 +02:00
Kim Alvefur
9547e0e66d
util.poll: Handle failed epoll FD creation
2018-10-11 18:52:12 +02:00
Kim Alvefur
22e0c16d4c
util.poll: Early return from __gc in case of no valid epoll FD
...
This could happen if the epoll FD has already been closed or
the epoll_create call failed
2018-10-11 18:50:04 +02:00
Kim Alvefur
28522988cc
util.poll: Increase max epoll events per call
...
This makes the struct roughly the same size in both epoll and select
mode (64bit).
There doesn’t seem to be much guidance on an appropriate size, it does
not seem to matter too much since if there are more events they will
simply show up in the next epoll_wait call. The number of exactly
concurrent events should be fairly low most of the time anyways.
2018-10-08 15:33:15 +02:00
Kim Alvefur
4a73f5daef
util.poll: Zero FD sets watched for errors on creation
2018-10-07 20:58:51 +02:00
Kim Alvefur
ceadb9c57c
net.poll: Guard against negative or too large FDs
2018-10-07 18:44:46 +02:00
Kim Alvefur
31c8b1aca3
util.poll: Fix missing return for adding duplicate FD
2018-10-07 18:41:44 +02:00
Kim Alvefur
8126707125
util.poll: Tweak metatable name field
2018-10-06 18:32:57 +02:00
Kim Alvefur
d3c236c693
util.poll: Fix monitoring of socket exceptions in select mode
...
Since state->err is a set of all watched FDs, this mistake caused all
sockets to appear to have errors.
2018-10-06 17:19:50 +02:00
Kim Alvefur
110ce660d5
util.poll: Lua 5.1 compat
2018-09-15 01:17:53 +02:00
Kim Alvefur
1ad376770f
util.poll: Remove 'inline' from function declaration
...
Why does this fix building?
2018-09-15 01:05:59 +02:00
Kim Alvefur
fa4507823f
util.poll: Import poll library with epoll and select support
2018-05-16 23:56:34 +02:00