1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Bug #44530 mtr v2 startup very slow on Windows.

MTR is stuck for about 20 seconds checking for free ports.
The reason is that perl's connect()  takes 1 second on windows
if port is not opened.

This patch fixes the mtr_ping_port implementation on Windows
to use Net::Ping for the port checking with small (0.1sec) timeout.

This patch also removes pointless second call to check_ports_free() 
in case of auto build thread.
This commit is contained in:
Vladislav Vaintroub
2009-04-28 23:06:36 +02:00
parent 361fa97258
commit 24e7fb05b5
2 changed files with 26 additions and 5 deletions

View File

@ -21,6 +21,9 @@
use strict;
use Socket;
use Errno;
use My::Platform;
use if IS_WINDOWS, "Net::Ping";
sub sleep_until_file_created ($$$);
sub mtr_ping_port ($);
@ -30,6 +33,25 @@ sub mtr_ping_port ($) {
mtr_verbose("mtr_ping_port: $port");
if (IS_WINDOWS)
{
# Under Windows, connect to a port that is not open is slow
# It takes ~1sec. Net::Ping with small timeout is much faster.
my $ping = Net::Ping->new();
$ping->port_number($port);
if ($ping->ping("localhost",0.1))
{
mtr_verbose("USED");
return 1;
}
else
{
mtr_verbose("FREE");
return 0;
}
}
my $remote= "localhost";
my $iaddr= inet_aton($remote);
if ( ! $iaddr )