Kim Alvefur
70e3e96c02
net.server_epoll: Backport timer optimization 6c2370f17027 from trunk (see #1388 )
...
The previous timer handling did not scale well and led to high CPU usage
with many connections (each with at least an read timeout).
7 years ago
Kim Alvefur
d2d042186f
net.server_epoll: Restore wantread flag after pause ( fixes #1354 )
...
If a chunk of data has been received that is larger than the amount read
at a time, then the connection is paused for a short time after which it
tries to read some more. If, after that, there is still more data to
read, it should do the same thing. However, because the "want read" flag
is removed and was restored after the delayed reading, it would not
schedule another delayed read.
7 years ago
Kim Alvefur
c422e8f134
net.server_epoll: Skip delayed continuation read on paused connections
...
This should prevent #1333 in cases where LuaSockets buffer is "dirty",
i.e. contains more data after a read, where it gets resumed with a
short delay.
7 years ago
Kim Alvefur
e34e8e845d
net.server_epoll: Handle LuaSec wantread/wantwrite conditions before callbacks ( fixes #1333 )
...
This prevents the :set(true) call from resuming a connection that was
paused in the onincoming callback.
7 years ago
Kim Alvefur
66d2e6adc3
net.server_epoll: Rename handshake_timeout to ssl_handshake_timeout ( fixes #1319 )
...
This is to match server_event, see 430797a8fc81
7 years ago
Kim Alvefur
8732027944
net.server_epoll: Use send_timeout for write timout like other implementations ( fixes #1316 )
7 years ago
Kim Alvefur
6176e9ff1b
server_epoll: Add comments describing config options
7 years ago
Kim Alvefur
448257af39
net.server_epoll: Remove unused config option
7 years ago
Kim Alvefur
160fd37742
server_epoll: Increase write timeout
...
7 may be too low for some slow machines and/or networks
7 years ago
Kim Alvefur
84c8383fb6
net.server_epoll: Shuffle variables earlier to improve readability
7 years ago
Kim Alvefur
2bb3772374
net.server_epoll: Special handling of signal interrupts
7 years ago
Kim Alvefur
afeb1f6f02
net.server_epoll: Ignore ENOENT when deregitering socket
...
It should not really happen
7 years ago
Kim Alvefur
bbf669b2c5
net.server_epoll: Graceful handling of registering already added socket
7 years ago
Kim Alvefur
0ac9ea3a74
net.server: Swich method for connecting sockets with remotes
...
LuaSocket TCP sockets have have both :connect and :setpeername, which
are the exact same function, however UDP sockets only have :setpeername.
Switching to :setpeername allows most of this code to be generic wrt
TCP/UDP.
7 years ago
Kim Alvefur
e1aa03deaa
net.server_epoll: Check return conditions of early socket setup
7 years ago
Kim Alvefur
f2d9638627
net.server_epoll: Add support for the conn_type argument to addclient
7 years ago
Kim Alvefur
fda067d696
net.server_epoll: Assert successful creation of util.poll handle
7 years ago
Kim Alvefur
0304fc6ba2
net.server_epoll: Update copyright year
7 years ago
Kim Alvefur
8a62a14e5d
net.server: Require IP address as argument to addclient (no DNS names)
...
The net.connect API should be used to resolve DNS names first
7 years ago
Kim Alvefur
6b592b4bee
net.server_epoll: Log error number from wait()
7 years ago
Kim Alvefur
9b2c4b2740
net.server_epoll: Pass error number to logging
...
Why do we ignore unused secondaries?
7 years ago
Kim Alvefur
d92dfb7bc8
net.server_epoll: Fix luacheck annotation
7 years ago
Kim Alvefur
27ad8d000e
net.server_epoll: Make :set_send a noop, should fix net.adns
...
This is also a noop in server_event. Supposedly meant to prevent
buffered writes from being sent to the socket, but that path becomes
unreachable when net.adns replaces the public send method
7 years ago
Kim Alvefur
b701156f2f
net.server_epoll: Inherit Direct TLS flag from servers to their clients
7 years ago
Kim Alvefur
68d9b01091
net.server_epoll: Catch errors from luasec.wrap
...
It throws if given an invalid TLS context
7 years ago
Kim Alvefur
9291209e82
net.server_epoll: Delay wrapping sockets in TLS until just before first handshake
7 years ago
Kim Alvefur
7a86af343f
net.connect: Fix passing request table to new listener
...
This could be a return value from ondetach
7 years ago
Kim Alvefur
437fd63c6f
net.server: Call a 'onattach' callback when replacing listeners
7 years ago
Kim Alvefur
341cb9cc54
net.server_epoll: Include errno in log messages
7 years ago
Kim Alvefur
83f3341452
net.server_epoll: Factor out IP/port detection into its own method
7 years ago
Kim Alvefur
6ba93205b0
net.server_epoll: Protect from errors in get{peer,sock}name
7 years ago
Kim Alvefur
e9146e8777
net.server_epoll: Watching instead of registering, seems more understandable
7 years ago
Kim Alvefur
44b031c207
net.server_epoll: Simplify minimal string representation
...
.conn might just be the FD sometimes
7 years ago
Kim Alvefur
cff0c75139
net.server_epoll: Add back setflags API for compat
7 years ago
Kim Alvefur
e4b4c42416
net.server_epoll: Fix write signal handling in watchfd API
...
The main loop calls :onwritable but here it was spelled :onwriteable
7 years ago
Kim Alvefur
fa6dce05f8
net.server_epoll: Use util.poll
8 years ago
Kim Alvefur
213be6f9a1
net.server_epoll: Make read_size a server-wide option
...
Can still be overriden per connection
7 years ago
Kim Alvefur
63125adc90
net.server_epoll: Rename pattern to read_size
7 years ago
Kim Alvefur
416607e20e
net.server_epoll: Refactor Direct TLS assumptions outwards
...
The assumption that connections are "Direct TLS" when a TLS context is
supplided should be broken. The goal is to make it easy to add a new API
that can be given a TLS context at creation even if it should do
STARTTLS.
With this commit, only the exposed server_select-compatible API assumes
Direct TLS when a TLS context is included.
7 years ago
Kim Alvefur
c3ba0cd3c5
net.server_epoll: Factor Direct TLS handling out of connection initialization
...
Eventually it should be possible to create a socket that has a TLS
context but that does not automatically start TLS on connect.
7 years ago
Kim Alvefur
4501390de5
net.server_epoll: Remove coercion of connections to strings
...
No longer needed since util.logger does this now
7 years ago
Kim Alvefur
60f7a7c3f1
net.server_epoll: Rename all variables holding TLS contexts for consistency
7 years ago
Kim Alvefur
24ff76428f
net.server: Set default read timeout to 14 minutes ( fixes #971 )
8 years ago
Kim Alvefur
7fa2aa0007
net.server: Add watchfd, a simple API for watching file descriptors
8 years ago
Kim Alvefur
4b973422dd
net.server_epoll: Guard against connection missing the getpeername method (thanks LuaSec)
8 years ago
Kim Alvefur
9bb53a64b8
net.server_epoll: Retry retrieving peername once connected
8 years ago
Kim Alvefur
14009b5cbd
net.server_epoll: Handle connection being closed and destroyed in onconnect callback
8 years ago
Kim Alvefur
43b814a83b
vairious: Add annotation when an empty environment is set [luacheck]
8 years ago
Kim Alvefur
60e13b6807
server_epoll: Onconnect should happen before first attempt to write to socket
8 years ago
Kim Alvefur
e2a3b634fb
net.server_epoll: Spelling writeable -> writable
8 years ago