Commit graph

522 commits

Author SHA1 Message Date
Sönke Ludwig 496e99c3b4 Make the API robust against using invalid handles. Fixes #105.
Introduces a "validationCounter" field for all handle types that gets incremented (at least) whenever an OS file descriptor/handle gets invalidated or re-allocated. This way, an old eventcore handle to a reused OS handle can always be distinguished from the current one to avoid interference.
2020-05-11 17:05:53 +02:00
Sönke Ludwig 768c6cf4c8
Merge pull request #143 from Geod24/deprecations
Fix a printf format deprecation triggered by 2.092
2020-05-11 17:03:01 +02:00
Sönke Ludwig 6372b4aabf
Merge pull request #141 from kubo39/patch-pipe-cloexec
Set close-on-exec flag for PipeFD
2020-05-11 11:23:37 +02:00
Geod24 3888f9f6a0 Fix a printf format deprecation triggered by 2.092 2020-05-11 11:14:03 +09:00
Hiroki Noda e6660486a3 Set close-on-exec flag for PipeFD 2020-04-09 21:36:19 +09:00
Sönke Ludwig 6845e055bd
Merge pull request #139 from vibe-d/tcp_state_fixes
Fix TCP state handling
2020-03-18 10:27:43 +01:00
Sönke Ludwig 8597d2ae34 Add missing ESHUTDOWN constant for macOS. 2020-03-18 07:59:41 +01:00
Sönke Ludwig 7c3fdc5ddf Fix possible hang after partial socket reads. 2020-03-17 15:15:19 +01:00
Sönke Ludwig 5c4e8be20a Add tests for TCP shutdown procedure and connection state handling. 2020-03-17 14:26:48 +01:00
Sönke Ludwig 3b44da604c Handle disconnects during socket read/write.
The connection state was not updated anymore since the changes in b32b329d15.

This fixes CI errors in vibe.d
2020-03-17 14:22:44 +01:00
The Dlang Bot 608f60237f
Merge pull request #132 from vibe-d/connect_callback_fix
Ensure that only the connect or the connection error callback is ever triggered.
merged-on-behalf-of: Leonid Kramer <l-kramer@users.noreply.github.com>
2020-03-16 08:34:10 +01:00
Sönke Ludwig 215735f48f Use MonoTime for timers. 2020-03-15 21:29:27 +01:00
Sönke Ludwig e8f35c0e0f Avoid a possible concurrent write to the same socket. 2020-03-15 21:07:43 +01:00
Sönke Ludwig e66b29d8df Loosen test timing to pass on Windows on the CI infrastructure. 2020-03-15 21:07:43 +01:00
Sönke Ludwig 00b8607fc1 Fix IOMode.immediate for Windows sockets to guarantee calling the callback. 2020-03-15 20:33:52 +01:00
Sönke Ludwig e8ed523c08 Fix transferred byte counter for windows stream socket reads/writes.
Fixes read/write sizes that are sometimes reported too small.
2020-03-15 20:33:52 +01:00
Sönke Ludwig f301e479a4 Run high level tests on Windows. 2020-03-15 20:33:52 +01:00
Sönke Ludwig b32b329d15 Fix the approach to determine connect failures.
On macOS it could happen that both, onConnect and onConnectError, were triggered, resulting in seemingly overlapping connection attempts when they really were sequential. This in turn triggered a connection error leak test in vibe-core.

Now using only the write-ready flag plus the reported socket error status to determine failed connections, guaranteeing a single call back.
2020-03-15 18:49:54 +01:00
Sönke Ludwig 4813cba338
Merge pull request #136 from Geod24/dip1000
Let malloc infer its attributes
2020-01-26 10:39:04 +01:00
Geod24 e7688361ba Let malloc infer its attributes
Malloc should not force '@safe' or '@nogc' on constructors which are not.
For example, TaskPool's ctor is not '@nogc' but was assumed as such
thanks to the delegate cast happening in malloc.
Likewise, the ctor or the arguments might not be '@safe',
or any other attributes, but they were be mistakenly marked as such.
2020-01-13 17:01:04 +09:00
Hiroki Noda 3fd907edd4 Remove unused function: min 2020-01-10 14:17:24 +09:00
Leonid Kramer 4e823ee1df
Merge pull request #131 from vibe-d/fix_dns_crash
Attempt to fix crash in thread based DNS lookup.
2019-10-25 22:46:08 +02:00
Sönke Ludwig 14a896be5d Attempt to fix crash in thread based DNS lookup.
Depending on the timing of starting and finishing DNS queries, `Thread.join` could be called on an instance that had already been `destroy`ed. To avoid this, the thread instance is now explicitly set to null, as well as resetting the "done" field to avoid redundant work for unused slots.

See vibe-d/vibe.d#2378.
2019-10-25 09:27:22 +02:00
Sönke Ludwig f6ac56664d Add API documentation links to README. 2019-10-08 21:26:43 +02:00
The Dlang Bot 38536e0be9
Merge pull request #126 from Geod24/suppert
Update list of compilers to match vibe-core
merged-on-behalf-of: Sönke Ludwig <s-ludwig@users.noreply.github.com>
2019-10-08 21:25:41 +02:00
Sönke Ludwig 8a4dc304dd
Fix missing build config. 2019-10-08 19:21:54 +02:00
Sönke Ludwig 9357cf485f
Merge pull request #130 from vibe-d/issue_vibed_2378_dns_lookup_memory_leak
Start a thread for each DNS lookup
2019-10-08 16:22:29 +02:00
Sönke Ludwig b77adfcbd2 Add proper thread synchronization to EventDriverDNS_GAI. 2019-10-07 11:18:58 +02:00
Sönke Ludwig 5255645455 Start a thread for each DNS lookup. Fixes vibe-d/vibe.d#2378.
std.parallelism.Task.executeInNewThread leaks the thread's resources instead of reusing it in later calls. As a workaround, this commit starts a new thread for every lookup and properly tears it down afterwards. At a later point, this code should be changed to reuse the thread(s), if possible, to avoid the startup overhead.
2019-10-07 11:10:21 +02:00
Sönke Ludwig f38a8cdb5a
Merge pull request #129 from kubo39/remove-unused-safeYield-function
Remove unused function `safeYield`
2019-09-26 19:12:26 +02:00
Hiroki Noda 4aa6420662 Remove unused function safeYield 2019-09-26 20:33:05 +09:00
Benjamin Schaaf 782fc40152 Add MSG_NOSIGNAL flag to send call to avoid SIGPIPE (#128)
Add MSG_NOSIGNAL flag to send call to avoid SIGPIPE
merged-on-behalf-of: Sönke Ludwig <s-ludwig@users.noreply.github.com>
2019-09-06 19:15:30 +02:00
Geod24 312f49ce65 Remove outdate comments for unsupported compilers 2019-09-03 02:10:02 +09:00
Geod24 86cb50bfd2 Update list of supported compiler to match vibe-core 2019-09-03 01:55:21 +09:00
Sönke Ludwig bca94d5736
Merge pull request #122 from vibe-d/fix_zombie_processes
Use waitpid to iterate over all exited child processes
2019-08-24 00:38:15 +02:00
Sönke Ludwig 20373d10db Fix indentation and remove unused imports/variables. 2019-08-23 19:55:55 +02:00
Sönke Ludwig 5c3afcc175 Ensure that a valid PID is passed to kill(). 2019-08-23 09:35:13 +02:00
Sönke Ludwig 01c2c26964 Fix Windows compilation.
Integrates the contents of StaticProcesses into PosixEventDriverProcesses to fully hide it form the Windows build. It also changes lockedProcessInfo to be a non-template function, as that lead to a linker error on macOS.
2019-08-23 09:35:13 +02:00
Sönke Ludwig f1c2eb779f Use the Posix process driver on all Posix operating systems. 2019-08-23 09:35:13 +02:00
Sönke Ludwig 7ebad49ed0 Rework the child process exit code to not rely in SIGCHLD.
It turns out that in a heterogeneous process where other parts of the code may start processes or threads and may be waiting for those to finish, it is not realistic to rely on signalfd or even SIGCHLD in general to get notified about child process exits. The only solid way appears to be to start a separate waiter thread that uses waitid/waitpid to wait for exited child processes in a blocking way.

This also fixes the hanging vibe.core.process test in vibe-core with DMD 2.087.x.
2019-08-23 09:35:12 +02:00
Sönke Ludwig 1ef320c329 Use a more robust way to self-execute the test binary. 2019-08-23 09:35:12 +02:00
Sönke Ludwig 4724f14145 Avoid interference with other users of waitpid.
Instead of using waitpid(-1), explicitly waits on all known processes. This is inefficient for large numbers of child processes, but seems to be the only way to ensure to not interfere with other code that uses waitpid().
2019-08-23 09:35:12 +02:00
Sönke Ludwig 72234fc0a7 Return an invalid wait ID for processes.wait() if the process has already exited.
Avoids overlap with valid wait IDs, so that a paired cancelWait() doesn't cancel a different wait.
2019-08-23 09:35:12 +02:00
Sönke Ludwig de199d3410 Add test for SIGCHLD coalescing. 2019-08-23 09:35:12 +02:00
Sönke Ludwig 507fb5a0c9 Use waitpid to iterate over all exited child processes. Fixes #116. Closes #117. 2019-08-23 09:35:12 +02:00
Sönke Ludwig e1c6d99798 Fix indentation style. 2019-08-23 09:35:11 +02:00
The Dlang Bot e23090b513
Merge pull request #123 from vibe-d/update_compiler_support
Test up to DMD 2.087.1/LDC 1.16.0.
merged-on-behalf-of: Sönke Ludwig <s-ludwig@users.noreply.github.com>
2019-08-23 09:15:31 +02:00
Sönke Ludwig 86b737968b Test up to DMD 2.087.1/LDC 1.16.0.
Drops all but the latest 4 versions and the oldest supported version (2.076.1) to avoid increasing CI pressure.
2019-08-22 23:40:01 +02:00
Sönke Ludwig 8c9b5e8ac2
Merge pull request #120 from calebccff/master
Fix #119
2019-08-21 09:24:25 +02:00
Caleb Connolly c2e55122bf
Fix #119
Added missing import to fix `undefined identifier intptr_t`
2019-08-20 17:43:25 +00:00