-my $client_exit = sub {
- my ($select, $web_socket, $old_termios) = @_;
-
- foreach my $fh ($select->handles) {
- $select->remove($fh);
-
- if ($fh == $web_socket) {
- if ($fh->connected) {
-
- # close connection
- # Opcode, mask, statuscode
- my $msg = "\x88" . pack('N', 0) . pack('n', 0);
- $fh->syswrite($msg);
- close($fh);
- }
- }
-
- }
-
- # switch back to blocking mode (else later shell commands will fail).
- STDIN->blocking(1);
-
- #
- # Reset the terminal parameters.
- #
- print "\e[24H\r\n";
- PVE::PTY::tcsetattr(*STDIN, $old_termios);
-};
-