Commit graph

185 commits

Author SHA1 Message Date
Kim Alvefur
43351d2b54 Spelling: Fix various spelling mistakes (thanks timeless)
Words, sometimes I wonder how they even work

Maybe I missed something.
2022-03-07 00:13:56 +01:00
Kim Alvefur
d06ae16295 net.server: Add a predrain callaback just before writes
Allows sneaking in things in the write buffer just before it's sent to
the network stack. For example ack requests, compression flushes or
other things that make sense to send after stanzas or other things.
This ensures any additional trailing data sent is included in the same
write, and possibly the same TCP packet. Other methods used such as
timers or nextTick might not have the same effect as it depends on
scheduling.
2021-08-16 12:34:52 +02:00
Kim Alvefur
61273591cd net.server_event: Silence luacheck warnings 2019-12-23 21:52:28 +01:00
Kim Alvefur
ecb6218ce7 server_event: Remove duplicated code (thanks waqas)
readcallback() calls onreadtimeout() and runs the exact same code if
onreadtimeout() doesn't return true, which it doesn't do.
2019-11-13 22:34:25 +01:00
Kim Alvefur
fb692a2ced net.server: Handle server name (SNI) as extra argument
Code added in 75d2874502c3, 9a905888b96c and adc0672b700e uses this field.

See #409 and #1408
2019-09-01 01:58:38 +02:00
Kim Alvefur
9afa1ac496 net.server: Accept and save an 'extra' field for client connections
This lets code attach some extra data to be attached to client
connections.
2019-09-01 01:55:55 +02:00
Kim Alvefur
20eaa5d17b net.server_event: Allow writing into buffer of write-locked connections
Check for 'nointerface' flag instead, whatever that means.
2019-03-24 19:07:39 +01:00
Maxime “pep” Buquet
dc241cf18e net/server_event: fix typo in comment 2019-03-23 01:57:12 +00:00
Kim Alvefur
5d2608e150 net.server: Only add alternate SNI contexts if at least one is provided
Fixes use of <starttls/> when a client sends SNI, which would send no certificate otherwise.
2019-03-11 13:00:51 +01:00
Kim Alvefur
af5e6fcb64 net.server_event: Add SNI support (#409)
Snippet adapted from server_epoll
2019-03-10 19:32:54 +01:00
Kim Alvefur
3cb132326d net.server: New API for creating server listeners
server.listen(interface, port, listeners, options);
2018-09-13 21:16:37 +02:00
Kim Alvefur
3899c7ac4b net.server: Add an API for holding writes of outgoing data 2018-10-25 15:12:59 +02:00
Kim Alvefur
eff5acbce1 net.server_event: Deprecate :lock_read here too 2018-10-28 16:51:58 +01:00
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.
2018-10-12 17:36:34 +02:00
Kim Alvefur
2104ac9fb0 net.server: Remove socket constructor fallback
Should no longer be needed
2018-10-12 16:24:49 +02:00
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
2018-10-11 15:48:30 +02:00
Kim Alvefur
7a86af343f net.connect: Fix passing request table to new listener
This could be a return value from ondetach
2018-09-26 17:36:53 +02:00
Kim Alvefur
437fd63c6f net.server: Call a 'onattach' callback when replacing listeners 2018-09-26 14:25:59 +02:00
Kim Alvefur
24ff76428f net.server: Set default read timeout to 14 minutes (fixes #971) 2018-07-06 19:02:19 +02:00
Kim Alvefur
7fa2aa0007 net.server: Add watchfd, a simple API for watching file descriptors 2018-05-09 16:15:40 +02:00
Matthew Wild
e80b165977 net.server_event: Don't close servers if just quitting the loop once 2018-04-10 20:41:03 +01:00
Kim Alvefur
3ec060fc0c Fix spelling throughout the codebase [codespell] 2018-02-04 01:51:25 +01:00
Matthew Wild
2727b7b723 net.server_event: Not every instantly-readable connection is an error, continue if possible 2018-02-23 15:41:12 +00:00
Matthew Wild
117211cdd6 net.server_event: Better outgoing connection error handling
Same as 67311cda0625. Check for readability. If a socket is readable
after initial connection, it likely means an error, so we call the
readcallback for that connection to handle it (and ultimately close).
2018-02-23 15:33:02 +00:00
Kim Alvefur
5acbf54cb4 net.server_event: Split long line [luacheck] 2017-11-10 05:50:03 +01:00
Kim Alvefur
047dbc4feb net.server_event: Add "libevent" to backend description 2017-10-09 02:22:33 +02:00
Kim Alvefur
56a3538054 Merge 0.10->trunk 2017-01-04 13:18:06 +01:00
Kim Alvefur
a6e9f2a8cd net.server_event: Also replace 'ondrain' when setting new listeners (thanks Ge0rG) 2017-01-04 11:24:48 +01:00
Kim Alvefur
de36c063b3 Merge 0.10->trunk 2016-10-08 21:07:12 +02:00
Kim Alvefur
4cb62f55f6 net.server_event: Restore destruction of socket on read timeout (lost since e67891ad18d6) (thanks Ge0rG) 2016-10-08 14:07:07 +02:00
Kim Alvefur
32be089091 Merge 0.10->trunk 2016-05-04 16:58:25 +02:00
Kim Alvefur
b1ec0f7993 net.server_event: Schedule another read callback if there is still data left in buffer after reading (fixes #583 for real) 2016-05-04 15:29:11 +02:00
Kim Alvefur
8e0208a805 net.server_event: Collect entire one line function on one line 2016-05-04 15:20:33 +02:00
Kim Alvefur
b42b0643f0 Merge 0.10->trunk 2016-04-19 19:00:46 +02:00
Kim Alvefur
4c8e24cd0a Merge 0.9->0.10 2016-04-19 19:00:19 +02:00
Kim Alvefur
9f66da1df0 net.server_event: Check the buffer *length*, not the buffer itself (Fixes 100% cpu usage introduced in 65abd9d7bf88) 2016-04-19 18:58:30 +02:00
Kim Alvefur
bcaeb22eb7 Merge 0.10->trunk 2016-04-19 18:23:44 +02:00
Kim Alvefur
be79af9fbb Merge 0.9->0.10 2016-04-19 18:23:02 +02:00
Kim Alvefur
376dab8b5e net.server_event: Return the correct value as timeout 2016-04-19 18:20:39 +02:00
Kim Alvefur
49aa55a51d net.server_event: Fix traceback if event re-added during starttls 2016-04-19 18:18:57 +02:00
Kim Alvefur
277ee1b09d Merge 0.10->trunk 2016-04-19 17:32:22 +02:00
Kim Alvefur
ee3e8bbd38 Merge 0.9->0.10 2016-04-19 17:30:30 +02:00
Kim Alvefur
2bf3239f76 net.server_event: Re-add write event if writebuffer is non-empty after write (eg due to writes from ondrain callback) (fixes #661) 2016-04-19 17:24:00 +02:00
Kim Alvefur
26261c7a51 Merge 0.10->trunk 2016-04-06 14:50:34 +02:00
Kim Alvefur
888df39003 Merge 0.10->trunk 2016-04-05 20:54:43 +02:00
Kim Alvefur
5c224f9d18 server_event: Split long list of assignments into multiple lines for readability 2016-04-05 20:41:50 +02:00
Kim Alvefur
dc117b2dc5 server_event: Fix indentation (again) 2016-04-05 20:39:36 +02:00
Kim Alvefur
e83b7f442b net.server_event: Return true from conn:resume() to indicate success 2016-03-02 16:30:46 +01:00
Kim Alvefur
52f557dece net.server_event: Prevent resuming connections without readcallback, eg closed connections (fixes #590) 2016-03-02 16:30:05 +01:00
Kim Alvefur
0b702d28ac Merge 0.10->trunk 2016-03-02 16:34:34 +01:00