Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorGlebs Ivanovskis <git-no-reply@zabbix.com>2015-12-21 16:35:45 +0300
committerGlebs Ivanovskis <git-no-reply@zabbix.com>2015-12-21 16:35:45 +0300
commit5545ef0980be347ecddd1a980b9a47be7894a7b0 (patch)
tree7e0cb357809d99f4349d3efea4e9da4ebea4442f /misc
parent95549469e2052eef8d99f14932fe88e3917e3c08 (diff)
....I..... [ZBX-10154] improved sender.pl script to take advantage of buffering (increases performance and makes communication with daemons more robust)
Diffstat (limited to 'misc')
-rwxr-xr-xmisc/debug/sender.pl4
1 files changed, 4 insertions, 0 deletions
diff --git a/misc/debug/sender.pl b/misc/debug/sender.pl
index 804af9e7a97..34303a967ba 100755
--- a/misc/debug/sender.pl
+++ b/misc/debug/sender.pl
@@ -27,6 +27,8 @@ do { print "Usage: $0 -h <host> -p <port> -i <file> -o <file>\n"; exit } if $hel
my $socket = new IO::Socket::INET(PeerAddr => $host, PeerPort => $port, Proto => 'tcp', Timeout => 1);
die "Could not connect to $host:$port: $!\n" unless $socket;
+$socket->autoflush(0);
+
open INPUT, $input;
my $send = do { local $/; <INPUT> };
my $length = length $send;
@@ -36,6 +38,8 @@ print $socket "ZBXD\1";
do { print $socket chr($length % 256); $length /= 256 } for 1..8;
print $socket $send;
+$socket->flush();
+
open OUTPUT, "> $output";
print OUTPUT while <$socket>;
close OUTPUT;