2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

00_MQTT2_SERVER.pm: avoid warnings with strange clients (Forum #124760)

git-svn-id: https://svn.fhem.de/fhem/trunk@25340 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2021-12-13 17:59:32 +00:00
parent cc6f458b93
commit 481eb1d7b6

View File

@ -240,11 +240,12 @@ sub
MQTT2_SERVER_out($$$;$)
{
my ($hash, $msg, $dump, $callback) = @_;
addToWritebuffer($hash, $msg, $callback);
addToWritebuffer($hash, $msg, $callback) if(defined($hash->{FD}));
if($dump) {
my $cpt = $cptype{ord(substr($msg,0,1)) >> 4};
$msg =~ s/([^ -~])/"(".ord($1).")"/ge;
Log3 $dump, 5, "out\@$hash->{FD} $cpt: $msg";
my $fd = defined($hash->{FD}) ? $hash->{FD} : "NoFd";
Log3 $dump, 5, "out\@$fd $cpt: $msg";
}
}
@ -311,7 +312,8 @@ MQTT2_SERVER_Read($@)
if($dump) {
my $msg = substr($hash->{BUF}, 0, $off+$tlen);
$msg =~ s/([^ -~])/"(".ord($1).")"/ge;
Log3 $sname, 5, "in\@$hash->{FD} $cpt: $msg";
my $fd = defined($hash->{FD}) ? $hash->{FD} : "NoFd";
Log3 $sname, 5, "in\@$fd $cpt: $msg";
}
$hash->{BUF} = substr($hash->{BUF}, $tlen+$off);