diff options
author | Olivier Blin <oblin@mandriva.com> | 2007-05-25 15:39:46 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2007-05-25 15:39:46 +0000 |
commit | 1d37bfdbbe874abd6dcb5563eea19f531de09e1c (patch) | |
tree | 74845e43ed8fa59c7aaafd1a87efaa6b0c83c228 /lib/network/test.pm | |
parent | c6ba983db7d5a82ee63599e775be0f8211447c72 (diff) | |
download | drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.tar drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.tar.gz drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.tar.bz2 drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.tar.xz drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.zip |
sync with 2007.1 (because of SVN loss)2007.1
Diffstat (limited to 'lib/network/test.pm')
-rw-r--r-- | lib/network/test.pm | 79 |
1 files changed, 41 insertions, 38 deletions
diff --git a/lib/network/test.pm b/lib/network/test.pm index ec680b7..36da41d 100644 --- a/lib/network/test.pm +++ b/lib/network/test.pm @@ -95,7 +95,7 @@ sub update_status { my ($o) = @_; if ($o->{kid}) { my $fd = $o->{kid}{fd}; - fcntl($fd, c::F_SETFL(), c::O_NONBLOCK()) or die "can not fcntl F_SETFL: $!"; + common::nonblock($fd); local $| = 1; if (defined(my $output = <$fd>)) { ($o->{address}, $o->{ping}) = $output =~ /^([\d\.]+)\|([\d\.,]+)*$/; @@ -111,48 +111,51 @@ sub update_status { =head2 Test synchronously -#- resolve and get ping to hostname from command line if given, else to www.mandriva.com -use lib qw(/usr/lib/libDrakX); -use network::test; +resolve and get ping to hostname from command line if given, else to www.mandriva.com -my $net_test = network::test->new($ARGV[0]); -$net_test->test_synchronous; + use lib qw(/usr/lib/libDrakX); + use network::test; -my $is_connected = $net_test->is_connected; -my $hostname = $net_test->get_hostname; -my $address = $net_test->get_address; -my $ping = $net_test->get_ping; + my $net_test = network::test->new($ARGV[0]); + $net_test->test_synchronous; -print "connected: $is_connected -host: $hostname -resolved host: $address -ping to host: $ping -"; + my $is_connected = $net_test->is_connected; + my $hostname = $net_test->get_hostname; + my $address = $net_test->get_address; + my $ping = $net_test->get_ping; + + print "connected: $is_connected + host: $hostname + resolved host: $address + ping to host: $ping + "; =head2 Test asynchronously -#- resolve and get ping to hostname from command line if given, else to Mandriva -#- prints a "." every 10 miliseconds during connection test -use lib qw(/usr/lib/libDrakX); -use network::test; - -my $net_test = network::test->new($ARGV[0]); -$net_test->start; - -do { - print ".\n"; - select(undef, undef, undef, 0.01); -} while !$net_test->is_done; - -my $is_connected = $net_test->is_connected; -my $hostname = $net_test->get_hostname; -my $address = $net_test->get_address; -my $ping = $net_test->get_ping; - -print "connected: $is_connected -host: $hostname -resolved host: $address -ping to host: $ping -"; +resolve and get ping to hostname from command line if given, else to Mandriva + +prints a "." every 10 miliseconds during connection test + + use lib qw(/usr/lib/libDrakX); + use network::test; + + my $net_test = network::test->new($ARGV[0]); + $net_test->start; + + do { + print ".\n"; + select(undef, undef, undef, 0.01); + } while !$net_test->is_done; + + my $is_connected = $net_test->is_connected; + my $hostname = $net_test->get_hostname; + my $address = $net_test->get_address; + my $ping = $net_test->get_ping; + + print "connected: $is_connected + host: $hostname + resolved host: $address + ping to host: $ping + "; =cut |