]> git.proxmox.com Git - pve-http-server.git/commitdiff
WS: guard disconnect block check properly
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 17 Dec 2021 09:55:34 +0000 (10:55 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 17 Dec 2021 10:05:03 +0000 (11:05 +0100)
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 <f.gruenbichler@proxmox.com>
src/PVE/APIServer/AnyEvent.pm

index d38cd5ac58b3a09bbbf3386e2016876d2972c423..f0305b3b9caea3aa93c3023022c23326439f0c47 100644 (file)
@@ -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();