mirror of
https://github.com/curl/curl.git
synced 2026-06-10 01:04:15 +03:00
Merge branch 'master' into fix-sftp-busy-loop
This commit is contained in:
commit
befada6472
2 changed files with 50 additions and 17 deletions
|
|
@ -644,6 +644,10 @@ CURLcode Curl_async_pollset(struct Curl_easy *data, struct easy_pollset *ps)
|
|||
struct async_thrdd_ctx *thrdd = &data->state.async.thrdd;
|
||||
CURLcode result = CURLE_OK;
|
||||
|
||||
#if !defined(USE_HTTPSRR_ARES) && defined(CURL_DISABLE_SOCKETPAIR)
|
||||
(void)ps;
|
||||
#endif
|
||||
|
||||
#ifdef USE_HTTPSRR_ARES
|
||||
if(thrdd->rr.channel) {
|
||||
result = Curl_ares_pollset(data, thrdd->rr.channel, ps);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,12 @@ use warnings;
|
|||
|
||||
use Time::HiRes;
|
||||
|
||||
use pathhelp qw(
|
||||
os_is_win
|
||||
);
|
||||
|
||||
my $has_win32_process;
|
||||
|
||||
BEGIN {
|
||||
use base qw(Exporter);
|
||||
|
||||
|
|
@ -43,6 +49,18 @@ BEGIN {
|
|||
set_advisor_read_lock
|
||||
clear_advisor_read_lock
|
||||
);
|
||||
|
||||
if(os_is_win() && $^O ne 'MSWin32') {
|
||||
$has_win32_process = eval {
|
||||
no warnings "all";
|
||||
# https://metacpan.org/pod/Win32::Process
|
||||
require Win32::Process;
|
||||
# https://metacpan.org/pod/Win32::Process::List
|
||||
require Win32::Process::List;
|
||||
};
|
||||
} else {
|
||||
$has_win32_process = 0;
|
||||
}
|
||||
}
|
||||
|
||||
use serverhelp qw(
|
||||
|
|
@ -51,10 +69,6 @@ use serverhelp qw(
|
|||
datasockf_pidfilename
|
||||
);
|
||||
|
||||
use pathhelp qw(
|
||||
os_is_win
|
||||
);
|
||||
|
||||
use globalconfig qw(
|
||||
$dev_null
|
||||
);
|
||||
|
|
@ -114,11 +128,18 @@ sub pidexists {
|
|||
if($pid > 4194304 && os_is_win()) {
|
||||
$pid -= 4194304;
|
||||
if($^O ne 'MSWin32') {
|
||||
my $filter = "PID eq $pid";
|
||||
# https://ss64.com/nt/tasklist.html
|
||||
my $result = `tasklist -fi \"$filter\" 2>$dev_null`;
|
||||
if(index($result, "$pid") != -1) {
|
||||
return -$pid;
|
||||
if($has_win32_process) {
|
||||
my %processes = Win32::Process::List->new()->GetProcesses();
|
||||
if(exists $processes{$pid}) {
|
||||
return -$pid;
|
||||
}
|
||||
} else {
|
||||
my $filter = "PID eq $pid";
|
||||
# https://ss64.com/nt/tasklist.html
|
||||
my $result = `tasklist -fi \"$filter\" 2>$dev_null`;
|
||||
if(index($result, "$pid") != -1) {
|
||||
return -$pid;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -145,10 +166,14 @@ sub pidterm {
|
|||
if($pid > 4194304 && os_is_win()) {
|
||||
$pid -= 4194304;
|
||||
if($^O ne 'MSWin32') {
|
||||
# https://ss64.com/nt/taskkill.html
|
||||
my $cmd = "taskkill -f -t -pid $pid >$dev_null 2>&1";
|
||||
print "Executing: '$cmd'\n";
|
||||
system($cmd);
|
||||
if($has_win32_process) {
|
||||
Win32::Process::KillProcess($pid, 0);
|
||||
} else {
|
||||
# https://ss64.com/nt/taskkill.html
|
||||
my $cmd = "taskkill -f -t -pid $pid >$dev_null 2>&1";
|
||||
print "Executing: '$cmd'\n";
|
||||
system($cmd);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -170,10 +195,14 @@ sub pidkill {
|
|||
if($pid > 4194304 && os_is_win()) {
|
||||
$pid -= 4194304;
|
||||
if($^O ne 'MSWin32') {
|
||||
# https://ss64.com/nt/taskkill.html
|
||||
my $cmd = "taskkill -f -t -pid $pid >$dev_null 2>&1";
|
||||
print "Executing: '$cmd'\n";
|
||||
system($cmd);
|
||||
if($has_win32_process) {
|
||||
Win32::Process::KillProcess($pid, 0);
|
||||
} else {
|
||||
# https://ss64.com/nt/taskkill.html
|
||||
my $cmd = "taskkill -f -t -pid $pid >$dev_null 2>&1";
|
||||
print "Executing: '$cmd'\n";
|
||||
system($cmd);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue