sauberes löschen der Instanzen geht nun

This commit is contained in:
Marko Oldenburg 2015-10-08 14:25:32 +02:00
parent 66440d28cd
commit 523b7211c0

View File

@ -79,7 +79,7 @@ sub AMAD_Define($$) {
my $port = 8090; my $port = 8090;
my $interval = 180; my $interval = 180;
$hash->{HOST} = $host; $hash->{HOST} = $host if( $host );
$hash->{PORT} = $port; $hash->{PORT} = $port;
$hash->{INTERVAL} = $interval if( $hash->{HOST} ); $hash->{INTERVAL} = $interval if( $hash->{HOST} );
$hash->{VERSION} = $version; $hash->{VERSION} = $version;
@ -98,6 +98,8 @@ sub AMAD_Define($$) {
} else { } else {
if( ! $modules{AMAD}{defptr}{BRIDGE} ) { if( ! $modules{AMAD}{defptr}{BRIDGE} ) {
CommandDefine( undef, "AMADCommBridge AMAD" ); CommandDefine( undef, "AMADCommBridge AMAD" );
Log3 $name, 3, "AMAD ($name) - there is already a AMAD Bridge";
} }
Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)"; Log3 $name, 3, "AMAD ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)";
@ -108,7 +110,7 @@ sub AMAD_Define($$) {
InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ) if( $hash->{HOST} ); InternalTimer( gettimeofday()+$hash->{INTERVAL}, "AMAD_GetUpdateTimer", $hash, 0 ) if( $hash->{HOST} );
#$modules{AMAD}{defptr}{$hash->$hash->{HOST}}; $modules{AMAD}{defptr}{$hash->{HOST}};
return undef; return undef;
} }
@ -121,13 +123,14 @@ sub AMAD_Undef($$) {
if( $hash->{BRIDGE} ) { if( $hash->{BRIDGE} ) {
delete $modules{AMAD}{defptr}{BRIDGE}; delete $modules{AMAD}{defptr}{BRIDGE};
my $ret = TcpServer_Close( $hash );
return $ret;
} else { } else {
delete $modules{AMAD}{defptr}{$hash->{HOST}}; delete $modules{AMAD}{defptr}{$hash->{HOST}};
RemoveInternalTimer( $hash ); RemoveInternalTimer( $hash );
my $ret = TcpServer_Close( $hash );
return $ret;
} }
} }