From 51e4974ca41d6efe574bae508b5ae2e20b964689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20B=C3=B6ker?= Date: Sun, 3 Mar 2024 21:37:58 +0100 Subject: [PATCH] Make `.write`s Promise result return the written bytes --- lib/IO/Socket/Async/SSL.pm6 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/IO/Socket/Async/SSL.pm6 b/lib/IO/Socket/Async/SSL.pm6 index ca597b6..7d4331d 100644 --- a/lib/IO/Socket/Async/SSL.pm6 +++ b/lib/IO/Socket/Async/SSL.pm6 @@ -931,7 +931,7 @@ class IO::Socket::Async::SSL { )); return $p; } - OpenSSL::SSL::SSL_write($!ssl, $b, $b.bytes); + my $ret = OpenSSL::SSL::SSL_write($!ssl, $b, $b.bytes); my $p = start { $lib-lock.protect: { self!flush-read-bio(); @@ -939,6 +939,7 @@ class IO::Socket::Async::SSL { # holding of $lib-lock in the code with the assignment. @!outstanding-writes .= grep({ $_ !=== $p }); } + $ret } @!outstanding-writes.push($p); $p