diff --git a/CHANGELOG.md b/CHANGELOG.md index 76c5ab5..bf4fc7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +1.9.0 - 2020- +================== + +- Implemented priority based task scheduling - [pull #196][issue196], [pull #197][issue197] + - Each task can be given a non-default priority that controls the relative frequency with which the task gets resumed in concurrent situations + - Events are now handled according to the calling task's priority instead of being handled immediately (can be reverted by defining a `VibeHighEventPriority` version) +- Fixeed a bogus contract violation error in `Timer.rearm` - [pull #195][issue195] + +[issue195]: https://github.com/vibe-d/vibe-core/issues/195 +[issue196]: https://github.com/vibe-d/vibe-core/issues/196 +[issue197]: https://github.com/vibe-d/vibe-core/issues/197 + + 1.8.1 - 2019-12-17 ================== @@ -9,7 +22,7 @@ 1.8.0 - 2019-12-07 ================== -- Adds a new path segment API that works without GC allocations (`GenericPath.bySegment2`/`.head2`) - this will replace the old API in version 2.x.x of the library - [pull #179][issue179] +- Added a new path segment API that works without GC allocations (`GenericPath.bySegment2`/`.head2`) - this will replace the old API in version 2.x.x of the library - [pull #179][issue179] - Added `GenericPath.byPrefix` to iterate over all acestor paths from root to leaf - [pull #181][issue181] - Fixed a bug with unitialized `YieldLock` instances (which can happen even with `@disable this()`) - [pull #180][issue180] - Heavily improved performance of `readFileUTF8` for large files by using a more efficient `sanitizyUTF8` implementation - [pull #182][issue182] diff --git a/source/vibe/core/core.d b/source/vibe/core/core.d index e23f61d..5307852 100644 --- a/source/vibe/core/core.d +++ b/source/vibe/core/core.d @@ -1507,20 +1507,6 @@ private void setupSignalHandlers() // per process setup shared static this() { - version(Windows){ - version(VibeLibeventDriver) enum need_wsa = true; - else version(VibeWin32Driver) enum need_wsa = true; - else enum need_wsa = false; - static if (need_wsa) { - logTrace("init winsock"); - // initialize WinSock2 - import core.sys.windows.winsock2; - WSADATA data; - WSAStartup(0x0202, &data); - - } - } - s_isMainThread = true; // COMPILER BUG: Must be some kind of module constructor order issue: diff --git a/source/vibe/core/net.d b/source/vibe/core/net.d index 8968cfe..86cc541 100644 --- a/source/vibe/core/net.d +++ b/source/vibe/core/net.d @@ -770,8 +770,13 @@ mixin(tracer); switch (res[1]) { default: throw new Exception("Error writing data to socket."); - case IOStatus.ok: break; - case IOStatus.disconnected: break; + case IOStatus.ok: + assert(mode != IOMode.all || res[2] == bytes.length); + break; + case IOStatus.disconnected: + if (mode == IOMode.all && res[2] != bytes.length) + throw new Exception("Connection closed while writing data."); + break; } return res[2]; diff --git a/source/vibe/core/sync.d b/source/vibe/core/sync.d index 6aef38b..f85d436 100644 --- a/source/vibe/core/sync.d +++ b/source/vibe/core/sync.d @@ -438,7 +438,6 @@ final class InterruptibleTaskMutex : Lockable { void unlock() nothrow { m_impl.unlock(); } } -version (VibeLibevDriver) {} else // timers are not implemented for libev, yet unittest { runMutexUnitTests!InterruptibleTaskMutex(); } @@ -475,7 +474,6 @@ final class RecursiveTaskMutex : core.sync.mutex.Mutex, Lockable { override void unlock() { m_impl.unlock(); } } -version (VibeLibevDriver) {} else // timers are not implemented for libev, yet unittest { runMutexUnitTests!RecursiveTaskMutex(); } @@ -507,7 +505,6 @@ final class InterruptibleRecursiveTaskMutex : Lockable { void unlock() { m_impl.unlock(); } } -version (VibeLibevDriver) {} else // timers are not implemented for libev, yet unittest { runMutexUnitTests!InterruptibleRecursiveTaskMutex(); } diff --git a/tests/vibe.core.net.1376.d b/tests/vibe.core.net.1376.d index 2d6529d..d9afb6f 100644 --- a/tests/vibe.core.net.1376.d +++ b/tests/vibe.core.net.1376.d @@ -2,7 +2,6 @@ name "tests" description "TCP disconnect task issue" dependency "vibe-core" path="../" - versions "VibeDefaultMain" +/ module test; @@ -10,7 +9,7 @@ import vibe.core.core; import vibe.core.net; import core.time : msecs; -shared static this() +void main() { auto l = listenTCP(0, (conn) { auto td = runTask!TCPConnection((conn) { @@ -39,4 +38,8 @@ shared static this() sleep(50.msecs); exitEventLoop(); }); + + runApplication(); + + l.stopListening(); } diff --git a/tests/vibe.core.net.1726.d b/tests/vibe.core.net.1726.d index 394ebc1..6f0838f 100644 --- a/tests/vibe.core.net.1726.d +++ b/tests/vibe.core.net.1726.d @@ -30,7 +30,11 @@ void performTest(bool reverse) auto wt = runTask!TCPConnection((conn) { sleep(reverse ? 100.msecs : 20.msecs); // give the connection time to establish try { - conn.write(buf); + // write enough to let the connection block long enough to let + // the remote end close the connection + // NOTE: on Windows, the first write() can actually complete + // immediately, but the second one blocks + foreach (i; 0 .. 2) conn.write(buf); assert(false, "Expected write() to throw an exception."); } catch (Exception) { write_ex = true;