00_MQTT2_SERVER.pm: fixing perl-5.26 errors (Forum #90145)

git-svn-id: https://svn.fhem.de/fhem/trunk@17120 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-08-10 16:09:21 +00:00
parent e208ab9794
commit 7744c0841a

View File

@ -72,7 +72,7 @@ MQTT2_SERVER_keepaliveChecker($)
{ {
my ($hash) = @_; my ($hash) = @_;
my $now = gettimeofday(); my $now = gettimeofday();
foreach my $clName (keys $hash->{clients}) { foreach my $clName (keys %{$hash->{clients}}) {
my $cHash = $defs{$clName}; my $cHash = $defs{$clName};
next if(!$cHash || !$cHash->{keepalive} || next if(!$cHash || !$cHash->{keepalive} ||
$now < $cHash->{lastMsgTime}+$cHash->{keepalive}*1.5 ); $now < $cHash->{lastMsgTime}+$cHash->{keepalive}*1.5 );
@ -335,7 +335,7 @@ MQTT2_SERVER_doPublish($$$;$$)
$hash->{retain}{$tp} = \%h; $hash->{retain}{$tp} = \%h;
} }
foreach my $clName (keys $hash->{clients}) { foreach my $clName (keys %{$hash->{clients}}) {
MQTT2_SERVER_sendto($defs{$clName}, $tp, $val) if(!$src || $src ne $clName); MQTT2_SERVER_sendto($defs{$clName}, $tp, $val) if(!$src || $src ne $clName);
} }
@ -353,7 +353,7 @@ MQTT2_SERVER_sendto($$$)
my ($hash, $topic, $val) = @_; my ($hash, $topic, $val) = @_;
return if(IsDisabled($hash->{NAME})); return if(IsDisabled($hash->{NAME}));
$val = "" if(!defined($val)); $val = "" if(!defined($val));
foreach my $s (keys $hash->{subscriptions}) { foreach my $s (keys %{$hash->{subscriptions}}) {
my $re = $s; my $re = $s;
$re =~ s,/?#,\\b.*,g; $re =~ s,/?#,\\b.*,g;
$re =~ s,\+,\\b[^/]+\\b,g; $re =~ s,\+,\\b[^/]+\\b,g;