Merge branch 'revert-d561f786' into 'develop'

Revert "Merge branch 'ent-4489-revision-comportamiento-pandora_server-e7' into 'develop'"

See merge request artica/pandorafms!2686
This commit is contained in:
Daniel Rodriguez 2019-08-28 14:33:10 +02:00
commit 94c36f98e7
1 changed files with 1 additions and 23 deletions

View File

@ -58,7 +58,6 @@ my %Agents :shared;
my $Sem :shared;
my $TaskSem :shared;
my $AgentSem :shared;
my $XMLinSem :shared;
########################################################################################
# Data Server class constructor.
@ -75,7 +74,6 @@ sub new ($$;$) {
$Sem = Thread::Semaphore->new;
$TaskSem = Thread::Semaphore->new (0);
$AgentSem = Thread::Semaphore->new (1);
$XMLinSem = Thread::Semaphore->new (1);
# Call the constructor of the parent class
my $self = $class->SUPER::new($config, DATASERVER, \&PandoraFMS::DataServer::data_producer, \&PandoraFMS::DataServer::data_consumer, $dbh);
@ -177,7 +175,6 @@ sub data_consumer ($$) {
my $agent_name = $1;
my $file_name = $pa_config->{'incomingdir'};
my $xml_err;
my $error;
# Fix path
$file_name .= "/" unless (substr ($file_name, -1, 1) eq '/');
@ -194,37 +191,18 @@ sub data_consumer ($$) {
for (0..1) {
eval {
local $SIG{__DIE__};
threads->yield;
# XML::SAX::ExpatXS is not thread safe.
if ($XML::Simple::PREFERRED_PARSER eq 'XML::SAX::ExpatXS') {
$XMLinSem->down();
}
$xml_data = XMLin ($file_name, forcearray => 'module');
if ($XML::Simple::PREFERRED_PARSER eq 'XML::SAX::ExpatXS') {
$XMLinSem->up();
}
};
# Invalid XML
if ($@) {
$error = 1;
if ($XML::Simple::PREFERRED_PARSER eq 'XML::SAX::ExpatXS') {
$XMLinSem->up();
}
}
if ($error || ref($xml_data) ne 'HASH') {
if ($@ || ref($xml_data) ne 'HASH') {
if ($@) {
$xml_err = $@;
} else {
$xml_err = "Invalid XML format.";
}
logger($pa_config, "Failed to parse $file_name $xml_err", 3);
sleep (2);
next;
}