Copied the newest tentacle_server from the tentacled repository.
(Fixed that tcp connection is not closed when timed out or connection refused by libwrap.)
This commit is contained in:
parent
a42947ea3a
commit
83cf83e153
|
@ -684,7 +684,13 @@ sub accept_connections {
|
|||
error ("accept: $!.");
|
||||
}
|
||||
|
||||
print_log ("Client connected from " . $t_client_socket->sockhost ());
|
||||
print_log ("Client connected from " . $t_client_socket->peerhost ());
|
||||
|
||||
if ($t_use_libwrap && (! hosts_ctl($t_program_name, $t_client_socket))) {
|
||||
print_log ("Connection from " . $t_client_socket->peerhost() . " is closed by tcpwrappers.");
|
||||
$t_client_socket->close();
|
||||
}
|
||||
else {
|
||||
|
||||
# Create a new thread and serve the client
|
||||
$t_sem->down();
|
||||
|
@ -693,6 +699,8 @@ sub accept_connections {
|
|||
error ("Error creating thread: $!.");
|
||||
}
|
||||
$thr->detach();
|
||||
$t_client_socket->close ();
|
||||
}
|
||||
}
|
||||
|
||||
usleep (1000);
|
||||
|
@ -705,15 +713,6 @@ sub accept_connections {
|
|||
################################################################################
|
||||
sub serve_client() {
|
||||
|
||||
if ($t_use_libwrap) {
|
||||
if (! hosts_ctl($t_program_name, $t_client_socket)) {
|
||||
print_log ("Connection from " . $t_client_socket->sockhost() . " is closed by tcpwrappers.");
|
||||
$t_client_socket->close ();
|
||||
$t_sem->up();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
eval {
|
||||
# Add client socket to select queue
|
||||
$t_select = IO::Select->new ();
|
||||
|
@ -737,7 +736,6 @@ sub serve_client() {
|
|||
}
|
||||
};
|
||||
|
||||
$t_client_socket->close ();
|
||||
$t_sem->up();
|
||||
}
|
||||
|
||||
|
|
|
@ -684,7 +684,13 @@ sub accept_connections {
|
|||
error ("accept: $!.");
|
||||
}
|
||||
|
||||
print_log ("Client connected from " . $t_client_socket->sockhost ());
|
||||
print_log ("Client connected from " . $t_client_socket->peerhost ());
|
||||
|
||||
if ($t_use_libwrap && (! hosts_ctl($t_program_name, $t_client_socket))) {
|
||||
print_log ("Connection from " . $t_client_socket->peerhost() . " is closed by tcpwrappers.");
|
||||
$t_client_socket->close();
|
||||
}
|
||||
else {
|
||||
|
||||
# Create a new thread and serve the client
|
||||
$t_sem->down();
|
||||
|
@ -693,6 +699,8 @@ sub accept_connections {
|
|||
error ("Error creating thread: $!.");
|
||||
}
|
||||
$thr->detach();
|
||||
$t_client_socket->close ();
|
||||
}
|
||||
}
|
||||
|
||||
usleep (1000);
|
||||
|
@ -705,15 +713,6 @@ sub accept_connections {
|
|||
################################################################################
|
||||
sub serve_client() {
|
||||
|
||||
if ($t_use_libwrap) {
|
||||
if (! hosts_ctl($t_program_name, $t_client_socket)) {
|
||||
print_log ("Connection from " . $t_client_socket->sockhost() . " is closed by tcpwrappers.");
|
||||
$t_client_socket->close ();
|
||||
$t_sem->up();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
eval {
|
||||
# Add client socket to select queue
|
||||
$t_select = IO::Select->new ();
|
||||
|
@ -737,7 +736,6 @@ sub serve_client() {
|
|||
}
|
||||
};
|
||||
|
||||
$t_client_socket->close ();
|
||||
$t_sem->up();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue