mirror of
git://git.proxmox.com/git/pve-common.git
synced 2025-03-11 20:58:41 +03:00
new helper wait_for_vnc_port()
This commit is contained in:
parent
845f01b6c4
commit
ec6d95b45d
2
Makefile
2
Makefile
@ -1,7 +1,7 @@
|
||||
RELEASE=2.2
|
||||
|
||||
VERSION=1.0
|
||||
PKGREL=35
|
||||
PKGREL=36
|
||||
|
||||
PACKAGE=libpve-common-perl
|
||||
|
||||
|
@ -580,6 +580,30 @@ sub extract_param {
|
||||
return $res;
|
||||
}
|
||||
|
||||
# Note: we use this to wait until vncterm is ready
|
||||
sub wait_for_vnc_port {
|
||||
my ($port, $timeout) = @_;
|
||||
|
||||
$timeout = 5 if !$timeout;
|
||||
|
||||
for (my $i = 0; $i < $timeout; $i++) {
|
||||
if (my $fh = IO::File->new ("/proc/net/tcp", "r")) {
|
||||
while (defined (my $line = <$fh>)) {
|
||||
if ($line =~ m/^\s*\d+:\s+([0-9A-Fa-f]{8}):([0-9A-Fa-f]{4})\s/) {
|
||||
if ($port == hex($2)) {
|
||||
close($fh);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
close($fh);
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub next_vnc_port {
|
||||
|
||||
for (my $p = 5900; $p < 6000; $p++) {
|
||||
|
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -1,3 +1,9 @@
|
||||
libpve-common-perl (1.0-36) unstable; urgency=low
|
||||
|
||||
* new helper wait_for_vnc_port()
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 24 Oct 2012 08:21:04 +0200
|
||||
|
||||
libpve-common-perl (1.0-35) unstable; urgency=low
|
||||
|
||||
* fix bug in read_memory_usage
|
||||
|
Loading…
x
Reference in New Issue
Block a user