2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 20:24:36 +00:00

00_MQTT2_CLIENT.pm: Initialize buffer after disconnect (Forum #91304)

git-svn-id: https://svn.fhem.de/fhem/trunk@22339 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2020-07-03 10:34:49 +00:00
parent 5f9473e5c3
commit 4b773202dc

View File

@ -86,6 +86,7 @@ MQTT2_CLIENT_connect($)
my $disco = (ReadingsVal($hash->{NAME}, "state", "") eq "disconnected");
$hash->{connecting} = 1 if($disco && !$hash->{connecting});
$hash->{nextOpenDelay} = 5;
$hash->{BUF}="";
return DevIo_OpenDev($hash, $disco, "MQTT2_CLIENT_doinit", sub(){})
if($hash->{connecting});
}
@ -206,6 +207,7 @@ MQTT2_CLIENT_Disco($;$)
if($ond && $ond =~ m/^(-r\s)?([^\s]*)\s*(.*)$/);
MQTT2_CLIENT_send($hash, pack("C",0xE0).pack("C",0), 1); # DISCONNECT
$isUndef ? DevIo_CloseDev($hash) : DevIo_Disconnected($hash);
delete($hash->{BUF});
}