Skip to content

Commit

Permalink
[hl] Ignore WANT_READ/WANT_WRITE errors when the socket is known to b…
Browse files Browse the repository at this point in the history
…e blocking.
  • Loading branch information
Apprentice-Alchemist committed May 4, 2024
1 parent 0adc110 commit b9279fc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions std/hl/_std/sys/ssl/Socket.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (__s.isBlocking)
return 0
else
throw haxe.io.Error.Blocked;
else if (r <= 0)
throw new haxe.io.Eof();
return r;
Expand Down Expand Up @@ -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 (__s.isBlocking)
return 0
else
throw haxe.io.Error.Blocked;
else if (r < 0)
throw new haxe.io.Eof();
return r;
Expand Down

0 comments on commit b9279fc

Please sign in to comment.