I now investigated a little more what happens when I interrupt the listening task, as you suggested:

You can do a t.interrupt() call, which causes an InterruptException to be thrown from read (which internally calls cancelRead).

Like I said before, I am using a TLS connection. An exception is thrown; however, it is not an InterruptException but a generic Exception. The message is

Reading from TLS stream: error:80000001:lib(128):func(0):reason(1) (2147483649)

With setLogLevel(LogLevel.debug_) I see a debug message

OpenSSL error at ../../.dub/packages/vibe-d-0.8.4/vibe-d/tls/vibe/stream/openssl.d:1149: error:80000001:lib(128):func(0):reason(1) (Error reading from underlying stream: Task interrupted.)

So this seems to be the reaction to the task interrupt. The problem now is that with a generic Exception the function calling read cannot distinguish the interrupt from other causes of failure.

I would be happy to provide a patch fixing this but I don’t really know where to look. Would you have any advice? Thanks in advance!