Commit graph

273 commits

Author SHA1 Message Date
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
Sönke Ludwig 356a34fad2 Implement simple (synchronous) DNS lookup for the WinAPI driver. 2017-01-23 21:37:35 +01:00
Sönke Ludwig 607bd1df09 Try executing DNS resolve tasks in a new thread to work around macOS hang. 2017-01-23 15:07:47 +01:00
Sönke Ludwig e72b071057 Add debug output for the getaddrinfo based DNS lookup driver. 2017-01-23 12:17:53 +01:00
Sönke Ludwig e55e23368a Fix compile error on macOS. 2017-01-23 11:52:09 +01:00
Sönke Ludwig d6321a2b52
Fix waiter count bookkeeping in PosixEventDriverEvents. 2017-01-23 11:34:14 +01:00
Sönke Ludwig e5078ad399
Fix ConsumableQueue.consume with no entries present. 2017-01-23 11:33:45 +01:00
Sönke Ludwig 0422ee495c
Fix null pointer error. 2017-01-23 11:15:03 +01:00
Sönke Ludwig a8aa505373
Fix Linux build. 2017-01-23 10:38:09 +01:00
Sönke Ludwig b556849af2 Fully fix the Win64 build (test might still fail). 2017-01-23 10:03:36 +01:00
Sönke Ludwig 2c4534d178 Fix Win64 build. 2017-01-23 09:09:30 +01:00
Sönke Ludwig 217a6698cb Fix type conversion error. 2017-01-22 21:55:51 +01:00
Sönke Ludwig 619948c4d5 Another fix attempt for the special read 0 behavior. 2017-01-22 21:29:12 +01:00
Sönke Ludwig 25bab3e37e Make the kqueue event driver work. 2017-01-22 20:54:09 +01:00
Sönke Ludwig c9c6d73f5e Make the kqueue event driver compile on macOS (doesn't work yet). 2017-01-22 18:43:29 +01:00
Sönke Ludwig 1c83076897 Fixup TCP read wait special case. 2017-01-22 12:40:07 +01:00
Sönke Ludwig dd5c88d1ed Fix compilation and event behavior on macOS. 2017-01-22 12:36:27 +01:00
Sönke Ludwig f5b514899a Add basic documentation for the driver interface. 2017-01-22 11:39:01 +01:00
Sönke Ludwig 58c89a7369 Implement proper zero size wait semantics for Posix stream sockets. 2017-01-22 10:47:58 +01:00
Sönke Ludwig ca81d25645 Implement socket adoption and fix wait loops on Windows for the Posix driver. 2017-01-22 10:43:18 +01:00
Sönke Ludwig 28040004cf Another compile fix. 2017-01-22 03:32:38 +01:00
Sönke Ludwig 55ea6c192f DMD 2.073.0-rc1 compile fixes. 2017-01-22 03:26:47 +01:00
Sönke Ludwig 922c9e8e72 Revert "Make the address parameter of send() scoped."
This reverts commit 1385250884.
2017-01-22 03:16:36 +01:00
Sönke Ludwig d6f6fc8357 Posix compile fix. 2017-01-22 03:10:46 +01:00
Sönke Ludwig 1385250884 Make the address parameter of send() scoped. 2017-01-22 03:05:46 +01:00
Sönke Ludwig 17c4fe65a8 Fix the Windows events implementation in the Posix driver. 2017-01-22 03:05:01 +01:00
Sönke Ludwig 924f2087f2 Fix premature event loop exit in case of waiting for events in the Posix driver. 2017-01-22 02:30:00 +01:00
Sönke Ludwig 0e38717669 Add unit test for SmallIntegerSet. 2017-01-22 02:28:40 +01:00
Sönke Ludwig 6b68e934f3 Implement file support for the WinAPI driver. 2017-01-22 02:01:13 +01:00
Sönke Ludwig 2a5252977e Implement events for the WinAPI driver. 2017-01-21 23:19:39 +01:00
Sönke Ludwig f7ec3da756 Implement directory watchers for the WinAPI driver. 2017-01-21 21:10:17 +01:00
Sönke Ludwig 4c7281dd01
Trivial refactor. 2017-01-21 17:27:54 +01:00
Sönke Ludwig 74d9242086
Final compile fix attempt. 2017-01-21 17:27:28 +01:00
Sönke Ludwig 40595fe133 Fix another compilation error. 2017-01-21 17:17:11 +01:00
Sönke Ludwig 0f325a47e4 Fix compilation error on Linux. 2017-01-21 16:40:28 +01:00
Sönke Ludwig 12e59b9c3c Implement basic event processing and timers for the WinAPI driver. 2017-01-21 16:39:48 +01:00
Sönke Ludwig 373cf45b1e Also fix compilation of PosixEventDriverEvents on Windows.
The previous commit actually didn't fully fix the Windows build.
2017-01-21 16:34:06 +01:00
Sönke Ludwig 64f6bb2a14 Make the select based configuration compile on Windows. 2017-01-21 16:19:34 +01:00
Sönke Ludwig a1f0cafeb3
Add IOMode parameter for file IO operations. 2017-01-19 00:24:38 +01:00
Sönke Ludwig 672e1c951d Adjust high level wrapper and test. 2017-01-15 21:59:15 +01:00
Sönke Ludwig 8b8169b868 Add EventDriverSockets.setBroadcast. 2017-01-15 21:42:05 +01:00
Sönke Ludwig 116940a5a7 Add EventDriverSockets.getLocalAddress and make parameters scope where possible. 2017-01-15 20:56:06 +01:00
Sönke Ludwig d8f10972eb Added EventDriverSockets.setKeepAlive. 2017-01-15 17:21:18 +01:00
Sönke Ludwig 2341762992 Fix range violation errors in ConsumableQueue. 2017-01-13 20:30:56 +01:00
Sönke Ludwig aa7b2946f3 Add shared overload of the EventDriver.events property.
This allows accessing the shared "trigger" method from a shared event driver.
2017-01-13 10:20:51 +01:00
Sönke Ludwig a3ca0965cf Fix wrong epoll timeout in case of already expired timers.
This could cause process/task starvation due to an infinite wait timeout.
2016-12-29 22:51:07 +01:00
Sönke Ludwig 06bcccd6ac Revert #1.
The idea is that every wait() produces exactly one callback unless cancelled.
2016-12-19 22:21:36 +01:00
Sönke Ludwig e33d36eb46 Fix compilation errors in the socket wrapper. 2016-12-19 22:16:34 +01:00
Sönke Ludwig cc3299fb88 Fix compilation on Windows and DMD 2.072.1. 2016-12-19 16:16:22 +01:00
Sönke Ludwig 8a365f6d07 Use the 0.8.x line of libasync and fix compilation of the (stub) libasync driver. 2016-12-18 23:55:59 +01:00
Sönke Ludwig 2acf44596a Avoid possible dangling objects referenced by timer callback delegates. Fixes #2. 2016-12-18 19:39:29 +01:00
Satoshi bfe1c46a73 Update timer.d
Don't remove callback when timer is periodic because after first hit cb cannot be called again?
2016-12-12 11:31:16 +01:00
Sönke Ludwig 7e9031439c Remove EventDriverFiles.createTemp() and add adopt() instead.
The rationale is to keep the event loop abstraction at a minimal size. createTemp(), to be generally useful, would also require a getFilename(fd) method and possibly more. adopt() on the other hand is frequently useful for wrapping other libraries.
2016-12-10 15:59:03 +01:00
Sönke Ludwig de89a5a9e1 Fix out-of-bounds access in SmallIntegerSet. 2016-12-10 15:53:59 +01:00
Sönke Ludwig 175368b334 Fix erroneously disabling some socket events in the Posix driver. 2016-11-29 11:58:46 +01:00
Sönke Ludwig ba61afbc2b Introduce debug version EventCoreEpollDebug.
Outputs some debug log messages for the epoll backend.
2016-11-29 11:56:23 +01:00
Sönke Ludwig c85d546efd Fix PosixEventDriverSockets.shutdown and .getConnectionState. 2016-11-04 21:29:05 +01:00
Sönke Ludwig 0cdde3008c Fix range violation in ConsumableQueue. 2016-11-04 21:28:08 +01:00
Sönke Ludwig d181a6730f Add bind address support for outgoing TCP connections. 2016-11-02 20:22:54 +01:00
Sönke Ludwig 35f5852d8f Disable the getaddrinfo_a based host name lookup.
Causes a stack address issue within vibe-core that still needs further debugging.
2016-10-25 00:13:21 +02:00
Sönke Ludwig 88600c5e21 Remove stack optimizations for DNS lookups and streamline send() signature. 2016-10-25 00:12:13 +02:00
Sönke Ludwig 39afb2ad21 Properly initialize accepted stream sockets. 2016-10-24 08:17:59 +02:00
Sönke Ludwig d6e77adfc5 Clear the full FD slot after the FD has been closed. 2016-10-24 07:55:39 +02:00
Sönke Ludwig 92c6783ef3 Fix ChoppedVector to properly use GC.addRange for allocated memory. 2016-10-24 07:55:00 +02:00
Sönke Ludwig 9bf0875778 Add event test and fix the notify_all==false case. 2016-10-24 00:44:55 +02:00
Sönke Ludwig 5450cda724 Make the FD map in the Posix event driver type safe. 2016-10-24 00:15:42 +02:00
Sönke Ludwig 2846637f95 Add AlgebraicChoppedVector as the future base for the event drivers FD map. 2016-10-24 00:12:35 +02:00
Sönke Ludwig 5cca0e863b Avoid default arguments in driver interface and streamline Handle declarations. 2016-10-24 00:11:40 +02:00
Sönke Ludwig e824278870 Fix possible null pointer access. 2016-10-19 22:00:22 +02:00
Sönke Ludwig ee1b9cbd4b Fix Linux build. 2016-10-19 14:30:16 +02:00
Sönke Ludwig 5f243cbb18 Improve cross-platform organization and fix compilation on Windows (posix driver). 2016-10-18 11:53:52 +02:00
Sönke Ludwig c12fefadcf Add stub/partial implementation of WinAPI and kqueue based drivers. 2016-10-17 21:59:00 +02:00
Sönke Ludwig 201e4f6077 Make all releaseRef() methods return a Boolean. 2016-10-17 21:53:30 +02:00
Sönke Ludwig e4e78a860a Implement inotify based directory watcher. 2016-10-17 21:42:09 +02:00
Sönke Ludwig 8ecc583e4d Make timer wait semantics consistent with other wait() functions. 2016-10-17 21:41:48 +02:00
Sönke Ludwig 270543d3d8 Implement getaddrinfo_a based DNS lookup for Linux. 2016-10-16 23:01:22 +02:00
Sönke Ludwig bdaff3264f Implement listening for signals based on signalfd(). 2016-10-16 21:06:11 +02:00
Sönke Ludwig 0cce1123fc Add getaddrinfo based DNS lookup implementation. 2016-10-16 14:30:52 +02:00
Sönke Ludwig 2b442f949b Add ChoppedVector.opApply. 2016-10-16 14:30:12 +02:00
Sönke Ludwig 2518a6c301 Add DNS API and update Libasync stub. 2016-10-14 22:24:31 +02:00
Sönke Ludwig c6dec730d8 Split up PosixEventDriver into individual classes. 2016-10-12 22:59:15 +02:00
Sönke Ludwig 2a44817911 Fix safety errors on DMD 2.072.0-b2. 2016-10-12 10:00:31 +02:00
Sönke Ludwig c526b58866 Fix notification/resource management bugs.
- Enforce that objects stay alive as long as a callback is pending
- Avoid multiple connect callbacks for connectStream
2016-10-07 20:22:39 +02:00
Sönke Ludwig 9d833a7a62 Use template alias paramters for callbacks in all socket wrapper functions. 2016-10-07 19:40:01 +02:00
Sönke Ludwig e2814315e4 Fix some socket bugs and improve code. 2016-10-07 19:39:13 +02:00
Sönke Ludwig 45931f2c17 Add a draft version of a managed socket wrapper API. 2016-10-07 12:40:10 +02:00
Sönke Ludwig c4e985b73c Implement UDP socket support. 2016-10-07 12:39:38 +02:00
Sönke Ludwig 2a8c52f347 Add a thread pool based async file implementation. 2016-10-06 22:04:33 +02:00
Sönke Ludwig a2691ff0af Add SmallIntegerSet utility container. 2016-10-06 15:14:18 +02:00
Sönke Ludwig 49116ede13 Fix doc comment formatting. 2016-10-05 21:09:14 +02:00
Sönke Ludwig 95ccc347d5 Add stub libasync support. 2016-10-05 14:38:29 +02:00
Sönke Ludwig b95c9e5bbc Remove redundancies from API function names. 2016-10-05 14:09:51 +02:00
Sönke Ludwig 80ce62aacb Name handle types, to make compiler error debugging easier. 2016-10-05 13:43:18 +02:00
Sönke Ludwig 4758f1f371 Add all remaining driver API methods. 2016-10-05 13:40:38 +02:00
Sönke Ludwig 3868ee64ce Sketch the missing driver API functions and avoid virtual function calls.
The individual interface getters are now overridden in the final sub classes to avoid virtual calls whenever the final type is used.
2016-10-05 13:15:04 +02:00
Sönke Ludwig e3c4af8433 Split up EventDriver interface into individual sub interfaces. 2016-10-05 04:21:24 +02:00
Sönke Ludwig 208c9ab345 Consume eventfd data to avoid the select based driver getting stuck. 2016-06-18 08:11:34 +02:00
Sönke Ludwig b05354416f Avoid log noise. 2016-06-17 22:28:52 +02:00
Sönke Ludwig bae3761924 Fix consumed range constructor. 2016-06-17 16:55:59 +02:00
Sönke Ludwig d2477ab4eb Fix triggerEvent and improve logging. 2016-06-17 16:51:58 +02:00
Sönke Ludwig 45c9865b69 Fix timer ID allocation. 2016-06-17 16:49:13 +02:00
Sönke Ludwig 32394bb4c9 Add clearExitFlag(). 2016-06-16 10:42:38 +02:00
Sönke Ludwig 1e27b33f26 Consider fired timers to be events that cause processEvents to return. 2016-06-15 22:18:24 +02:00
Sönke Ludwig 96a8c95b81 Properly round event timeout for the epoll driver.
Avoids continuous 0 msec timeouts just before timers expire.
2016-06-15 22:17:34 +02:00
Sönke Ludwig 80df8e1ce8 Fix out-of-bounds error in ConsumableQueue. 2016-06-15 22:16:49 +02:00
Sönke Ludwig f808f89e7c Fix issues for posix events and cleanup cancel semantics.
Cancelling an operation now guarantees that the callback won't be called.
2016-06-15 18:20:32 +02:00
Sönke Ludwig fe939bff18 Fix range errors in ConsumableQueue and add removePending. 2016-06-15 18:18:26 +02:00
Sönke Ludwig 5298e00c09 Remove redundant callback parameter from createTimer. 2016-06-14 09:25:06 +02:00
Sönke Ludwig 5ec6b9a5e5 Add more interface functions.
- Cancelling of socket read/write events
- Cancelling of timer waits
- Retrieving the TCP connection state
- Storing custom data together with the event structures
2016-06-14 07:57:10 +02:00
Sönke Ludwig 87487f9e71 Fix deprecation warnings on DMD 2.071.0. 2016-05-18 12:47:30 +02:00
Sönke Ludwig 0b7adc993f Implement manual events in the PosixEventDriver and add waitTimer. 2016-02-03 14:21:02 +01:00
Sönke Ludwig 844e955cdb Add EventDriver.exit and move all event callback parameters to the end. 2016-01-27 11:02:54 +01:00
Sönke Ludwig 3d8183248c Add ConsumableQueue helper container. 2016-01-27 11:00:29 +01:00
Sönke Ludwig 8212d9e16a Add module descriptions for the driver implementations. 2016-01-16 16:33:20 +01:00
Sönke Ludwig b92be4a29d Move drivers to an own package. 2016-01-16 15:50:47 +01:00
Sönke Ludwig be99b48216 Don't compile EpollEventDriver outside of Linux. 2016-01-16 15:48:27 +01:00
Sönke Ludwig eee5091f2f Fix Windows compilation of SelectEventDriver/PosixEventDriver. 2016-01-16 15:48:03 +01:00
Sönke Ludwig 52c74e6633 Always use edge-triggered events. 2016-01-16 14:48:43 +01:00
Sönke Ludwig 47c16c65cc Register sockets for events only once.
Only the callbacks are set and unset now, resulting in a considerable performance boost for the epoll backend.
2016-01-16 14:48:30 +01:00
Sönke Ludwig 2a926d87aa Initial version with sone partial Posix implementations. 2016-01-11 21:33:49 +01:00