On 25/01/2023 09:25, Wolfgang Bumiller wrote:
The general approach is fine, but `run_with_timeout` uses SIGALRM and
messes with signal handlers which is rather inelegant for such a thing,
we should limit its use to when we have no other option (mainly
file-locking).

For this case we can just use IO::Poll like:

     my $poll = IO::Poll->new();
     $poll->mask($sock => POLLIN | POLLHUP); # watch for input & EOF
     $poll->poll($shutdown_timeout);

If the socket was closed, then `$poll->mask($sock)` should contain the
`POLLHUP` bits.

Thanks for the suggestion, looks much nicer! I'll send a new version of the patch.



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to