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 POSIX ":sys_wait_h";
|
||||
use Time::HiRes qw(usleep);
|
||||
use Scalar::Util qw(refaddr);
|
||||
|
||||
# Constants for Win32 services.
|
||||
use constant WIN32_SERVICE_STOPPED => 0x01;
|
||||
|
@ -684,7 +685,7 @@ sub accept_connections {
|
|||
my $pid;
|
||||
my $t_server_socket;
|
||||
|
||||
# Ignore SIGPIPE errors (happens on FreeBSD when SSL is enabled ¿?)
|
||||
# Ignore SIGPIPE
|
||||
$SIG{PIPE} = 'IGNORE';
|
||||
|
||||
# Start server
|
||||
|
@ -774,14 +775,21 @@ sub serve_proxy_connection {
|
|||
|
||||
# Forward data between the client and the server.
|
||||
eval {
|
||||
while (1) {
|
||||
if ($t_select->can_read(0)) {
|
||||
my $select = IO::Select->new ();
|
||||
$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);
|
||||
return unless defined($data);
|
||||
send_data_proxy($data);
|
||||
}
|
||||
if ($t_proxy_select->can_read(0)) {
|
||||
}
|
||||
else {
|
||||
my ($read, $data) = recv_data_proxy($t_block_size);
|
||||
return unless defined($data);
|
||||
send_data($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -974,8 +982,10 @@ sub print_log {
|
|||
sub error {
|
||||
|
||||
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 POSIX ":sys_wait_h";
|
||||
use Time::HiRes qw(usleep);
|
||||
use Scalar::Util qw(refaddr);
|
||||
|
||||
# Constants for Win32 services.
|
||||
use constant WIN32_SERVICE_STOPPED => 0x01;
|
||||
|
@ -774,14 +775,21 @@ sub serve_proxy_connection {
|
|||
|
||||
# Forward data between the client and the server.
|
||||
eval {
|
||||
while (1) {
|
||||
if ($t_select->can_read(0)) {
|
||||
my $select = IO::Select->new ();
|
||||
$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);
|
||||
return unless defined($data);
|
||||
send_data_proxy($data);
|
||||
}
|
||||
if ($t_proxy_select->can_read(0)) {
|
||||
}
|
||||
else {
|
||||
my ($read, $data) = recv_data_proxy($t_block_size);
|
||||
return unless defined($data);
|
||||
send_data($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue