aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_epoll.lua
Commit message (Collapse)AuthorAgeFilesLines
* net.server_epoll: Fix reporting of socket connect timeoutKim Alvefur2021-06-071-0/+2
| | | | | | | | | | | | | | | | | | | If the underlying TCP connection times out before the write timeout kicks in, end up here with err="timeout", which the following code treats as a minor issue. Then, due to epoll apparently returning the EPOLLOUT (writable) event too, we go on and try to write to the socket (commonly stream headers). This fails because the socket is closed, which becomes the error returned up the stack to the rest of Prosody. This also trips the 'onconnect' signal, which has effects on various things, such as the net.connect state machine. Probably undesirable effects. With this, we instead return "connection timeout", like server_event, and destroy the connection handle properly. And then nothing else happens because the connection has been destroyed.
* net.server_epoll: Remove unnecessary luacheck annotationsKim Alvefur2021-04-011-3/+3
| | | | | Not sure why these were here to begin with, since it does use the 'self' argument and did so since they were added.
* net.server_epoll: Support for passing DANE TLSA data to LuaSec (0.8 needed)Kim Alvefur2019-09-291-0/+14
|
* Merge 0.11->trunkKim Alvefur2021-01-081-2/+18
|\
| * net.server_epoll: Ensure timers can't run more than once per tickKim Alvefur2021-01-081-2/+18
| | | | | | | | | | | | | | | | This makes sure that a timer that returns 0 (or less) does not prevent runtimers() from completing, as well as making sure a timer added with zero timeout from within a timer does not run until the next tick. Thanks tmolitor
| * net.server: Backport client parts of SNI support from trunk (#409)Kim Alvefur2020-08-171-5/+15
| | | | | | | | | | | | | | | | | | | | Partial backports of the following commits from trunk: 6c804b6b2ca2 net.http: Pass server name along for SNI (fixes #1408) 75d2874502c3 net.server_select: SNI support (#409) 9a905888b96c net.server_event: Add SNI support (#409) adc0672b700e net.server_epoll: Add support for SNI (#409) d4390c427a66 net.server: Handle server name (SNI) as extra argument
| * net.server_epoll: Fix indentationKim Alvefur2020-03-111-3/+3
| | | | | | | | | | | | Some lines seem to have gotten the wrong indentation, possibly caused by Meld which often ignores lines with only whitespace changes and leaves their previous indentation.
| * net.server_epoll: Backport timer optimization 6c2370f17027 from trunk (see ↵Kim Alvefur2019-07-081-48/+29
| | | | | | | | | | | | | | #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).
* | net.server_epoll: Increase log level for error in callbackKim Alvefur2020-12-161-1/+1
| | | | | | | | It's an error, it should be logged at error level.
* | net.server_epoll: Log debug message when a connection errors on readKim Alvefur2020-07-251-0/+5
| | | | | | | | | | | | It's confusingly quiet otherwise, even with maximum verboseness. Thanks perflyst
* | net.server_epoll: Add setting for turning off callback protectionsKim Alvefur2020-06-301-0/+6
| | | | | | | | | | Might improve (CPU) performance at the risk of triggering top level errors.
* | net.server_epoll: Allow setting a custom error handler for listenerKim Alvefur2020-06-301-1/+2
| | | | | | | | This lets plugins handle errors in some custom way, should they wish to.
* | net.server_epoll: ... and include a tracebackKim Alvefur2020-06-301-1/+1
| |
* | net.server_epoll: Report errors in timersKim Alvefur2020-06-301-0/+2
| |
* | net.server_epoll: Expose way to turn monotonic time into wall clock timeKim Alvefur2020-06-301-0/+3
| |
* | net.server_epoll: Optimize away table allocation for timer objectsKim Alvefur2020-06-291-15/+21
| |
* | net.server_epoll: Remove unused time field from timer objectsKim Alvefur2020-06-291-6/+3
| | | | | | | | Unused since the move to util.indexedbheap in c8c3f2eba898
* | net.server_epoll: Signal API-compatibilty with util.timerKim Alvefur2020-06-291-0/+6
| | | | | | | | | | Reduces the overhead of having both util.timer and the timer handling here, since they are very similar and now API-compatible.
* | net.server_epoll: Make API-compatible with util.timerKim Alvefur2020-06-291-3/+3
| |
* | net.server_epoll: Add way to start accepting clients on an arbitrary server ↵Kim Alvefur2020-06-011-4/+9
| | | | | | | | | | | | socket This adds an escape hatch where things like UNIX sockets can be added.
* | net.server_epoll: Handle missing ports from getsock/peername (as in the case ↵Matthew Wild2020-06-011-2/+2
| | | | | | | | of unix sockets)
* | net.server_epoll: Fix typo in internal method nameKim Alvefur2020-05-221-5/+5
| |
* | net.server_epoll: Log some noise before TLS handshake stepKim Alvefur2020-05-221-0/+1
| | | | | | | | | | This would help pinpoint if a crash happens during the handshake, which has occurred a few times, e.g. like https://github.com/brunoos/luasec/issues/75
* | net.server_epoll: Reduce log level of TLS handshake errors to debugKim Alvefur2020-02-151-1/+1
| | | | | | | | | | | | | | These are triggered all the time by random HTTPS connections, so they are mostly just useless noise. When you actually do need them, you probably have debug logging enabled too, since these messages are fairly useless without more context.
* | net.server_epoll: Different error to distinguish connection timeoutKim Alvefur2020-02-011-1/+2
| | | | | | | | This mirrors what server_event does.
* | net.server_epoll: Log error about missing *all* callbacks at 'error' levelKim Alvefur2020-01-121-1/+1
| |
* | net.server_epoll: Log errors caught in listeners on 'error' levelKim Alvefur2020-01-121-1/+1
| |
* | net.server_epoll: Add option for reducing debug loggingKim Alvefur2020-01-121-14/+25
| | | | | | | | | | | | | | Sometimes all these things just drown out the logs you are interested in with low-level socket noise. Enabled since it's still new and experimental.
* | net.server_epoll: Collect full traceback from errors in listenersKim Alvefur2020-01-051-1/+3
| |
* | net.server_epoll: Avoid concatenating buffer with single itemKim Alvefur2019-12-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Saves creating a string that'll be identical to buffer[1] anyways, as well as a C function call. Depending on Lua version and length of the string, this could be reusing an interned string, but a longer one would probably be duplicated for no reason. Having exactly one item in the buffer seems like it would be fairly common, but I have not done an extensive study. If opportunistic writes are enabled then it will be even more likely. This special case could be optimized like this in table.concat but it does not look like it is.
* | net.server_epoll: Remove an unused variable [luacheck]Kim Alvefur2019-12-231-1/+1
| |
* | net.server_epoll: Use monotonic time for schedulingKim Alvefur2019-12-081-9/+11
| | | | | | | | Timer API of passing wallclock time remains
* | net.server_epoll: Change timer rescheduling method to match util.timerKim Alvefur2019-12-081-2/+3
| | | | | | | | | | Relative to current time instead of absolute time, in preparation for switching to monotonic time.
* | net.server_epoll: Remove unused function for adding timer at absolute timeKim Alvefur2019-12-081-8/+3
| | | | | | | | This won't make sense if we switch to monotonic time
* | net.server_epoll: Add debug logging for delayed readingKim Alvefur2019-12-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In :onreadable, if there is still buffered incoming data after reading from the socket (as indicated by the :dirty method, usually because LuaSocket has an 8k buffer that's full but it read a smaller amount), another attempt to read is scheduled via this :pausefor method. This is also called from some other places where it would be pointless to read because there shouldn't be any data. In the delayed read case, this should report that the socket is "dirty". If it reports that the socket is "clean" then the question is where the buffer contents went? If this doesn't get logged after the scheduled time (0.000001s by default) then this would suggests a problem with timer or scheduling.
* | net.server_epoll: Save log tag in a field on FD watchers tooKim Alvefur2019-11-171-2/+4
| | | | | | | | As with 0e1701197722
* | Back out c8aa66595072: Extra changes accidentally includedKim Alvefur2019-11-171-5/+3
| |
* | net.server_epoll: Save log tag in a field on FD watchers tooKim Alvefur2019-11-171-3/+5
| | | | | | | | As with 0e1701197722
* | net.server_epoll: Improve read timeout debug messagesKim Alvefur2019-10-191-2/+2
| |
* | net.server_epoll: Clarify a debug messageKim Alvefur2019-10-191-1/+1
| | | | | | | | Writing what? The data that's been buffered for writing
* | net.server_epoll: Save IP and port from connection creation callKim Alvefur2019-10-121-0/+4
| | | | | | | | Might come out of :getpeername different later but at least it's something.
* | server_epoll: Log full string represestation when connectedKim Alvefur2019-10-121-1/+1
| | | | | | | | Since they may have been unknown when the connection was created.
* | net.server_epoll: Handle getpeer/sockname returning a normal errorKim Alvefur2019-10-121-2/+2
| | | | | | | | | | These will sometimes return nil, "Transport not connected" but not throw a hard error. This shouldn't be treated as success.
* | net.server_epoll: Fix to get remote IP on direct TLS connectionsKim Alvefur2019-10-121-0/+1
| | | | | | | | | | | | | | | | A Direct TLS connection (eg HTTPS) gets turned into a LuaSec handle before the :updatenames call done in the :connect method. LuaSec does not expose the :getpeername and :getsockname methods, so the addresses remain obscured, making debugging trickier since the actual IP addrerss connected to does not show up.
* | net.server_epoll: Move a log message to improve orderingKim Alvefur2019-10-121-1/+1
| | | | | | | | It was weird that it said "Prepared to start TLS" before "Client .. created"
* | net.server_epoll: Guard against nil return from TLS info methodKim Alvefur2019-10-061-2/+2
| |
* | net.server_epoll: Log TLS version and cipher for all completed handshakesKim Alvefur2019-10-061-1/+6
| | | | | | | | | | The similar logging in mod_c2s and mod_s2s does not cover all connections, like HTTPS or other Direct TLS ports.
* | net.server_epoll: Log size of partial writes (debug)Kim Alvefur2019-10-051-0/+1
| |
* | net.server_epoll: Return early when attepting to set write lock state to ↵Kim Alvefur2019-10-051-0/+6
| | | | | | | | | | | | current state Reduces needless duplication of work and log messages..
* | net.server_epoll: Correct indentationKim Alvefur2019-09-291-2/+2
| |