From 8149e5e66436b5dac8f8b3f3fa09b2aac3e7f9d8 Mon Sep 17 00:00:00 2001 From: Zeta <53486764+Apprentice-Alchemist@users.noreply.github.com> Date: Thu, 25 Jul 2024 15:40:56 +0200 Subject: [PATCH] [hl] Ignore WANT_READ/WANT_WRITE errors when the socket is known to be blocking. (#11655) --- std/hl/_std/sys/ssl/Socket.hx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/std/hl/_std/sys/ssl/Socket.hx b/std/hl/_std/sys/ssl/Socket.hx index f16818b9f14..d8fa1b39424 100644 --- a/std/hl/_std/sys/ssl/Socket.hx +++ b/std/hl/_std/sys/ssl/Socket.hx @@ -50,7 +50,10 @@ private class SocketInput extends haxe.io.Input { __s.handshake(); var r = @:privateAccess __s.ssl.recv(buf, pos, len); if (r == -1) - throw haxe.io.Error.Blocked; + if (@:privateAccess __s.isBlocking) + return 0 + else + throw haxe.io.Error.Blocked; else if (r <= 0) throw new haxe.io.Eof(); return r; @@ -85,7 +88,10 @@ private class SocketOutput extends haxe.io.Output { __s.handshake(); var r = @:privateAccess __s.ssl.send(buf, pos, len); if (r == -1) - throw haxe.io.Error.Blocked; + if (@:privateAccess __s.isBlocking) + return 0 + else + throw haxe.io.Error.Blocked; else if (r < 0) throw new haxe.io.Eof(); return r;