mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-02 19:15:31 +00:00
00_MQTT2_SERVER.pm: open the port after $init_done (Forum #138451)
git-svn-id: https://svn.fhem.de/fhem/trunk@28986 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
ec7708e231
commit
7ddfcd6c0b
@ -82,18 +82,22 @@ MQTT2_SERVER_Define($$)
|
|||||||
|
|
||||||
MQTT2_SERVER_resetClients($hash);
|
MQTT2_SERVER_resetClients($hash);
|
||||||
MQTT2_SERVER_Undef($hash, undef) if($hash->{OLDDEF}); # modify
|
MQTT2_SERVER_Undef($hash, undef) if($hash->{OLDDEF}); # modify
|
||||||
my $ret = TcpServer_Open($hash, $port, $global);
|
|
||||||
|
|
||||||
# Make sure that fhem only runs once
|
|
||||||
if($ret && !$init_done) {
|
|
||||||
Log3 $hash, 1, "$ret. Exiting.";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
readingsSingleUpdate($hash, "nrclients", 0, 0);
|
readingsSingleUpdate($hash, "nrclients", 0, 0);
|
||||||
$hash->{clients} = {};
|
$hash->{clients} = {};
|
||||||
$hash->{retain} = {};
|
$hash->{retain} = {};
|
||||||
InternalTimer(1, "MQTT2_SERVER_keepaliveChecker", $hash, 0);
|
InternalTimer(1, "MQTT2_SERVER_keepaliveChecker", $hash, 0);
|
||||||
return $ret;
|
|
||||||
|
if($init_done) {
|
||||||
|
return TcpServer_Open($hash, $port, $global);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
InternalTimer(1, sub(){ #138451
|
||||||
|
my $ret = TcpServer_Open($hash, $port, $global);
|
||||||
|
Log 1, $ret if($ret);
|
||||||
|
}, $hash, 0);
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub
|
sub
|
||||||
|
Loading…
x
Reference in New Issue
Block a user