mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
2014-08-06 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/NetworkServer.pm: Rewrote TCP module socket code for sending data (tcp_send). Fixes ticket #1096. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10385 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
9b7a8cec71
commit
ded9780100
@ -1,3 +1,8 @@
|
|||||||
|
2014-08-06 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* lib/PandoraFMS/NetworkServer.pm: Rewrote TCP module socket code for
|
||||||
|
sending data (tcp_send). Fixes ticket #1096.
|
||||||
|
|
||||||
2014-08-05 Hirofumi Kosaka <kosaka@rworks.jp>
|
2014-08-05 Hirofumi Kosaka <kosaka@rworks.jp>
|
||||||
|
|
||||||
* lib/PandoraFMS/Core.pm: Suppress "going to normal (warning,
|
* lib/PandoraFMS/Core.pm: Suppress "going to normal (warning,
|
||||||
|
@ -25,6 +25,7 @@ use threads::shared;
|
|||||||
use Thread::Semaphore;
|
use Thread::Semaphore;
|
||||||
|
|
||||||
use IO::Socket::INET6;
|
use IO::Socket::INET6;
|
||||||
|
use IO::Select;
|
||||||
use HTML::Entities;
|
use HTML::Entities;
|
||||||
use POSIX qw(strftime);
|
use POSIX qw(strftime);
|
||||||
|
|
||||||
@ -190,6 +191,10 @@ sub pandora_query_tcp ($$$$$$$$$$) {
|
|||||||
my @tcp_send = split( /\|/, $tcp_send );
|
my @tcp_send = split( /\|/, $tcp_send );
|
||||||
my @tcp_rcv = split( /\|/, $tcp_rcv );
|
my @tcp_rcv = split( /\|/, $tcp_rcv );
|
||||||
|
|
||||||
|
# Add server socket to select queue
|
||||||
|
my $select = IO::Select->new ();
|
||||||
|
$select->add ($handle);
|
||||||
|
|
||||||
next_pair:
|
next_pair:
|
||||||
$tcp_send = shift( @tcp_send );
|
$tcp_send = shift( @tcp_send );
|
||||||
$tcp_rcv = shift( @tcp_rcv );
|
$tcp_rcv = shift( @tcp_rcv );
|
||||||
@ -205,13 +210,12 @@ next_pair:
|
|||||||
if ((defined ($tcp_rcv) && $tcp_rcv ne "") || (($id_tipo_modulo == 10) || ($id_tipo_modulo ==8) || ($id_tipo_modulo == 11))) {
|
if ((defined ($tcp_rcv) && $tcp_rcv ne "") || (($id_tipo_modulo == 10) || ($id_tipo_modulo ==8) || ($id_tipo_modulo == 11))) {
|
||||||
# Receive data, non-blocking !!!! (VERY IMPORTANT!)
|
# Receive data, non-blocking !!!! (VERY IMPORTANT!)
|
||||||
$temp2 = "";
|
$temp2 = "";
|
||||||
for ($tam=0; $tam<$timeout; $tam++){
|
for ($tam = 0; $tam < $timeout; $tam ++) {
|
||||||
$handle->recv($temp,16000,0x40);
|
if ($select->can_read (1)) {
|
||||||
|
my $read = sysread ($handle, $temp, 16000);
|
||||||
|
last if (! defined ($read) || $read == 0); # No more data or something went wrong
|
||||||
$temp2 = $temp2.$temp;
|
$temp2 = $temp2.$temp;
|
||||||
if ($temp ne ""){
|
|
||||||
$tam++; # If doesnt receive data, increase counter
|
|
||||||
}
|
}
|
||||||
sleep(1);
|
|
||||||
}
|
}
|
||||||
if ($id_tipo_modulo == 9){ # only for TCP Proc
|
if ($id_tipo_modulo == 9){ # only for TCP Proc
|
||||||
if ($temp2 =~ /$tcp_rcv/i){ # String match !
|
if ($temp2 =~ /$tcp_rcv/i){ # String match !
|
||||||
|
Loading…
x
Reference in New Issue
Block a user