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
8f49a022b0
commit
06ea5990ec
@ -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>
|
||||
|
||||
* lib/PandoraFMS/Core.pm: Suppress "going to normal (warning,
|
||||
|
@ -25,6 +25,7 @@ use threads::shared;
|
||||
use Thread::Semaphore;
|
||||
|
||||
use IO::Socket::INET6;
|
||||
use IO::Select;
|
||||
use HTML::Entities;
|
||||
use POSIX qw(strftime);
|
||||
|
||||
@ -190,6 +191,10 @@ sub pandora_query_tcp ($$$$$$$$$$) {
|
||||
my @tcp_send = split( /\|/, $tcp_send );
|
||||
my @tcp_rcv = split( /\|/, $tcp_rcv );
|
||||
|
||||
# Add server socket to select queue
|
||||
my $select = IO::Select->new ();
|
||||
$select->add ($handle);
|
||||
|
||||
next_pair:
|
||||
$tcp_send = shift( @tcp_send );
|
||||
$tcp_rcv = shift( @tcp_rcv );
|
||||
@ -206,12 +211,11 @@ next_pair:
|
||||
# Receive data, non-blocking !!!! (VERY IMPORTANT!)
|
||||
$temp2 = "";
|
||||
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;
|
||||
if ($temp ne ""){
|
||||
$tam++; # If doesnt receive data, increase counter
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
if ($id_tipo_modulo == 9){ # only for TCP Proc
|
||||
if ($temp2 =~ /$tcp_rcv/i){ # String match !
|
||||
|
Loading…
x
Reference in New Issue
Block a user