Explictly avoid double-resumption of tasks during Libevent2TCPConnection.close().

The previous fix for #1376 resulted in a possible task starvation when the peer reset the connection before the outbound buffer was drained. The new approach now always resumes the waiting task exactly once, no matter how many events happen and no matter in which order.

(cherry picked from commit 350130a2b05cfbf12764ffaa6a86403eacf172d9)
This commit is contained in:
Sönke Ludwig 2016-04-10 14:18:14 +02:00
parent dc9002de0e
commit 3a6583b375

View file

@ -1274,7 +1274,7 @@ package(vibe) void resumeCoreTask(CoreTask ctask, Exception event_exception = nu
nothrow @safe { nothrow @safe {
assert(ctask.thread is () @trusted { return Thread.getThis(); } (), "Resuming task in foreign thread."); assert(ctask.thread is () @trusted { return Thread.getThis(); } (), "Resuming task in foreign thread.");
assert(() @trusted nothrow { return ctask.state; } () == Fiber.State.HOLD, "Resuming fiber that is not on HOLD"); assert(() @trusted nothrow { return ctask.state; } () == Fiber.State.HOLD, "Resuming fiber that is not on HOLD");
assert(ctask.m_queue is null, "Manually resuming task that is already scheduled to resumed."); assert(ctask.m_queue is null, "Manually resuming task that is already scheduled to be resumed.");
if( event_exception ){ if( event_exception ){
extrap(); extrap();