Commit graph

169 commits

Author SHA1 Message Date
Sönke Ludwig 06c6e0a4ca
Add basic UDP multicast support.
This also adds a new setOption method to handle boolean socket options in a generic way.
2017-09-03 18:14:57 +02:00
Sönke Ludwig 07baa0f612
Improve performance of accepting incoming connections.
- Removes the accept() loop, as that doesn't measurably improve performance in practice. This also gives each connection the possibility to perform initial I/O before more concurrency is generated by accepting the next connection.

- Uses SOCK_NONBLOCK in conjunction with socket() and accept4() to save one additional syscall per connection.
2017-09-02 15:40:07 +02:00
Sönke Ludwig fc5df2f949
Use level-triggered events for listening stream sockets.
The limit of 20 accepted connections per event invocation can otherwise lead to no more connections being accepted when more that 20 connections are available at a time. This is an adaptation of @Boris-Barboris pull request #21 to restrict the level triggered behavior to listening sockets. See also #20.
2017-09-02 00:12:58 +02:00
Sönke Ludwig eb595ef858 Fix always calling GC.addRange in ChoppedVector if necessary. 2017-08-26 22:33:00 +02:00
Sönke Ludwig 74352a9ac5 Avoid dangling socket slot access in the WinAPI driver.
When the last reference got released while a blocking socket operation was still in progress, the old slot was still accessed from the completion callback, leading to null pointer accesses or other issues.
2017-08-21 21:02:13 +02:00
Sönke Ludwig 44b43e8415
Fix error message. 2017-08-14 15:14:05 +02:00
Sönke Ludwig a63907b9f7
Fix multiple bugs in ThreadedFileEventDriver.
- Errors were reported as "ok"
- The cancel state logic was flawed and could lose cancel requests
- Operations could be removed from the active sets before they actually finished, causing the callback to never get called
2017-08-14 01:58:42 +02:00
Sönke Ludwig dd873ec6cf
Add example to get(Local/Remove)Address and fix some ddoc syntax errors. 2017-08-12 21:25:27 +02:00
Sönke Ludwig 09a67149bc
Use a linked list for the timer queue.
Improves insertion and deletion times for many pending timers considerably.
2017-07-21 21:35:10 +02:00
Sönke Ludwig beef9c2567
Add a doubly linked list implementation. 2017-07-21 21:35:10 +02:00
Sönke Ludwig 1c666a0191
Fix send() return value handling.
A value of 0 doesn't indicate a closed connection as for recv().
2017-07-19 10:42:33 +02:00
Sönke Ludwig 9518ec4dce
Remove log noise for listening TCP sockets. 2017-07-14 12:35:17 +02:00
Sönke Ludwig 077c643e08 Fix 64-bit compile error. 2017-06-27 00:54:32 +02:00
Sönke Ludwig a7e5b49943 Implement basic UDP support for the WinAPI driver.
Note that the IOMode.immediate semantics are not compatible with the current 0-udp.d test and will instead call the callback asynchronously. It appears that non-blocking semantics are generally not possible with overlapped sockets.
2017-06-26 23:37:33 +02:00
Sönke Ludwig a263637bd3 Fix WSASend/WSARecv usage w.r.t. WSABUF parameter.
The documentation states that the buffer must be kept alive during the whole operation, so using a stack allocated buffer is illegal.
2017-06-26 23:31:22 +02:00
Sönke Ludwig ef065762b3 Fix WinAPIEventDriverCore.waiterCount to include pending timers. 2017-06-26 23:28:15 +02:00
Sönke Ludwig ca11fdec82 Implement WinAPI based TCP socket support. 2017-06-24 22:31:16 +02:00
Sönke Ludwig ab796477e2 Move .userData to the socket driver.
Generally each FD type should have its own .userData property in the respective driver. This is important for drivers that don't have a unified file descriptor space and need to store user data in a type specific way.
2017-06-24 22:01:32 +02:00
Sönke Ludwig d99eb1be34
Fix waiter count tracking in the Posix driver. Fixes #8. 2017-06-10 10:27:55 +02:00
Sönke Ludwig abf8587078
Add SmallIntegerSet.empty. 2017-06-10 10:27:20 +02:00
Sönke Ludwig 8e385d8b1d
Fix epoll status event masks. Fixes #10. 2017-06-10 00:06:45 +02:00
Sönke Ludwig 1ff3d00020
Check return value of eventfd for errors. 2017-06-10 00:06:45 +02:00
Sönke Ludwig f4ca542b92
Add assertions in ChunkedVector to detect failed memory allocations. 2017-06-10 00:06:45 +02:00
pinver 435e365c3a idem, avoid to pollute the console as default 2017-04-25 16:32:01 +02:00
pinver 1be26214e6 avoid to pollute the console by default 2017-04-25 16:28:31 +02:00
Sönke Ludwig 872f1b12b9
For direction of getLocalAddress and getRemoteAddress. 2017-03-24 09:04:32 +01:00
Sönke Ludwig 420c361b5f Fix WinAPI sockets stub. 2017-03-11 09:17:38 +01:00
Sönke Ludwig 758256c210
Fix compilation of the libasync driver stub. 2017-03-10 22:56:07 +01:00
Sönke Ludwig 1d330d6330
Extend datagram socket API.
Adds .setTargetAddress() and makes .getXAddress() work for datagram sockets, too.
2017-03-10 22:46:43 +01:00
Sönke Ludwig 2e5b13ee98
Add EventDriverSockets.getRemoteAddress. 2017-03-10 20:25:28 +01:00
Sönke Ludwig a25b49228f Properly count IO completion as an event in WinAPIEventDriverCore.processEvents. 2017-03-09 16:02:42 +01:00
Sönke Ludwig bcc059e6d7 Fix bogus outOfWaiters event loop exit reason for active event waits. 2017-02-22 17:35:26 +01:00
Sönke Ludwig 578065f70a Fix exit conditions in the WinAPI event loop. 2017-02-22 17:34:44 +01:00
Sönke Ludwig f84139ba63 Fix infinite look when stopping timers with multiple others pending. 2017-02-22 17:33:03 +01:00
Sönke Ludwig 49521f2586
Remove debug output. 2017-01-31 10:06:51 +01:00
Sönke Ludwig 4b357c3326
Make sure the socket ref count can reach zero in user code. 2017-01-30 23:11:09 +01:00
Sönke Ludwig 490dc15128
Properly handle the case where a TCP connection gets immediately disconnected.
This can result in both, the write-ready and the disconnect events, to be triggered during the same event loop iteration.
2017-01-30 22:52:13 +01:00
Sönke Ludwig 773e09cd3d
Fix (immediate) detection of remove connection close for EPOLL. 2017-01-30 21:01:31 +01:00
Sönke Ludwig 5a5dcd6376
Remove debug output. 2017-01-30 20:11:40 +01:00
Sönke Ludwig 6851776358
Add EventDriverTimers.isUnique. 2017-01-30 19:54:38 +01:00
Sönke Ludwig 956978cc79
Fix out of order processing issue with the TCP connection callback.
It could happen that the socket FD got reused before the connection callback was cleared. This in turn could result in the new connection callback to get overwritten with null.
2017-01-30 10:54:43 +01:00
Sönke Ludwig 4703f021ec
Fix setting initial state for incoming TCP connections. 2017-01-29 21:00:27 +01:00
Sönke Ludwig 3d81854214
Add StreamListenOptions.
Can be used to set the SO_REUSEPORT option for multi-thread/multi-process incoming TCP connection distribution.
2017-01-27 22:09:05 +01:00
Sönke Ludwig 4e830a408f Split up WinAPI driver into separate files. 2017-01-25 16:14:06 +01:00
Sönke Ludwig 87394165de Only bind outgoing stream sockets explicitly if requested. 2017-01-25 12:57:02 +01:00
Sönke Ludwig ea60f55a8d
Fix another compile error. 2017-01-25 12:35:42 +01:00
Sönke Ludwig b52747247b
Fix Linux compilation. 2017-01-25 12:33:00 +01:00
Sönke Ludwig d1829669ec Split up Posix event driver into separate files. 2017-01-25 00:11:57 +01:00
Sönke Ludwig 0b012e7ec7 Remove duplicate declaration. 2017-01-23 22:31:23 +01:00
Sönke Ludwig d3e8005662 Fix Win64 compilation. 2017-01-23 22:24:27 +01:00