mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Merged the latest version of the Tentacle server from the SF repo.
This commit is contained in:
parent
9f2a149600
commit
e44ef7ddc1
Binary file not shown.
@ -64,6 +64,7 @@ use threads;
|
|||||||
use Thread::Semaphore;
|
use Thread::Semaphore;
|
||||||
use POSIX ":sys_wait_h";
|
use POSIX ":sys_wait_h";
|
||||||
use Time::HiRes qw(usleep);
|
use Time::HiRes qw(usleep);
|
||||||
|
use Scalar::Util qw(refaddr);
|
||||||
|
|
||||||
# Constants for Win32 services.
|
# Constants for Win32 services.
|
||||||
use constant WIN32_SERVICE_STOPPED => 0x01;
|
use constant WIN32_SERVICE_STOPPED => 0x01;
|
||||||
@ -684,7 +685,7 @@ sub accept_connections {
|
|||||||
my $pid;
|
my $pid;
|
||||||
my $t_server_socket;
|
my $t_server_socket;
|
||||||
|
|
||||||
# Ignore SIGPIPE errors (happens on FreeBSD when SSL is enabled ¿?)
|
# Ignore SIGPIPE
|
||||||
$SIG{PIPE} = 'IGNORE';
|
$SIG{PIPE} = 'IGNORE';
|
||||||
|
|
||||||
# Start server
|
# Start server
|
||||||
@ -774,14 +775,21 @@ sub serve_proxy_connection {
|
|||||||
|
|
||||||
# Forward data between the client and the server.
|
# Forward data between the client and the server.
|
||||||
eval {
|
eval {
|
||||||
while (1) {
|
my $select = IO::Select->new ();
|
||||||
if ($t_select->can_read(0)) {
|
$select->add($t_proxy_socket);
|
||||||
|
$select->add($t_client_socket);
|
||||||
|
while (my @ready = $select->can_read()) {
|
||||||
|
foreach my $socket (@ready) {
|
||||||
|
if (refaddr($socket) == refaddr($t_client_socket)) {
|
||||||
my ($read, $data) = recv_data($t_block_size);
|
my ($read, $data) = recv_data($t_block_size);
|
||||||
|
return unless defined($data);
|
||||||
send_data_proxy($data);
|
send_data_proxy($data);
|
||||||
}
|
}
|
||||||
if ($t_proxy_select->can_read(0)) {
|
else {
|
||||||
my ($read, $data) = recv_data_proxy($t_block_size);
|
my ($read, $data) = recv_data_proxy($t_block_size);
|
||||||
|
return unless defined($data);
|
||||||
send_data($data);
|
send_data($data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -974,8 +982,10 @@ sub print_log {
|
|||||||
sub error {
|
sub error {
|
||||||
|
|
||||||
if ($t_quiet == 0) {
|
if ($t_quiet == 0) {
|
||||||
die("[err] $_[0]\n\n");
|
print (STDERR "[err] $_[0]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
die("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
Binary file not shown.
@ -64,6 +64,7 @@ use threads;
|
|||||||
use Thread::Semaphore;
|
use Thread::Semaphore;
|
||||||
use POSIX ":sys_wait_h";
|
use POSIX ":sys_wait_h";
|
||||||
use Time::HiRes qw(usleep);
|
use Time::HiRes qw(usleep);
|
||||||
|
use Scalar::Util qw(refaddr);
|
||||||
|
|
||||||
# Constants for Win32 services.
|
# Constants for Win32 services.
|
||||||
use constant WIN32_SERVICE_STOPPED => 0x01;
|
use constant WIN32_SERVICE_STOPPED => 0x01;
|
||||||
@ -774,14 +775,21 @@ sub serve_proxy_connection {
|
|||||||
|
|
||||||
# Forward data between the client and the server.
|
# Forward data between the client and the server.
|
||||||
eval {
|
eval {
|
||||||
while (1) {
|
my $select = IO::Select->new ();
|
||||||
if ($t_select->can_read(0)) {
|
$select->add($t_proxy_socket);
|
||||||
|
$select->add($t_client_socket);
|
||||||
|
while (my @ready = $select->can_read()) {
|
||||||
|
foreach my $socket (@ready) {
|
||||||
|
if (refaddr($socket) == refaddr($t_client_socket)) {
|
||||||
my ($read, $data) = recv_data($t_block_size);
|
my ($read, $data) = recv_data($t_block_size);
|
||||||
|
return unless defined($data);
|
||||||
send_data_proxy($data);
|
send_data_proxy($data);
|
||||||
}
|
}
|
||||||
if ($t_proxy_select->can_read(0)) {
|
else {
|
||||||
my ($read, $data) = recv_data_proxy($t_block_size);
|
my ($read, $data) = recv_data_proxy($t_block_size);
|
||||||
|
return unless defined($data);
|
||||||
send_data($data);
|
send_data($data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user