From 6277311e7136a7b972d526384edd3b72b9587fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Fri, 17 Dec 2021 10:55:34 +0100 Subject: [PATCH] WS: guard disconnect block check properly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit if the WS gets disconnected without any data having been sent first, wbuf (and thus `length $wbuf`) is undef. the actual length of the buffer is not relevant here anyway, just the fact that it's non-empty - so avoid the undef warning by dropping the unnecessary comparison. Signed-off-by: Fabian Grünbichler --- src/PVE/APIServer/AnyEvent.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm index d38cd5a..f0305b3 100644 --- a/src/PVE/APIServer/AnyEvent.pm +++ b/src/PVE/APIServer/AnyEvent.pm @@ -636,7 +636,8 @@ sub websocket_proxy { my $statuscode = unpack ("n", $payload); $self->dprint("websocket received close. status code: '$statuscode'"); if (my $proxyhdl = $reqstate->{proxyhdl}) { - $proxyhdl->{block_disconnect} = 1 if length $proxyhdl->{wbuf} > 0; + $proxyhdl->{block_disconnect} = 1 if length $proxyhdl->{wbuf}; + $proxyhdl->push_shutdown(); } $hdl->push_shutdown();