From 08feae92c15ec127bb9038cd9615670b0824b4cd Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Mon, 8 Nov 2021 21:38:02 +0100 Subject: [PATCH] Close handle when closing the stream At the end of the connection, each side sends a close_notify alert to inform the peer that the connection is closed. IO::Socket::SSL does that, if its close method is called. --- lib/Mojo/IOLoop/Stream.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Mojo/IOLoop/Stream.pm b/lib/Mojo/IOLoop/Stream.pm index 2f191ce5ac..fdcc0c82ce 100644 --- a/lib/Mojo/IOLoop/Stream.pm +++ b/lib/Mojo/IOLoop/Stream.pm @@ -25,6 +25,7 @@ sub close { return unless my $handle = delete $self->timeout(0)->{handle}; $reactor->remove($handle); $self->emit('close'); + $handle->close; } sub close_gracefully { $_[0]->is_writing ? $_[0]{graceful}++ : $_[0]->close }