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

verify short and long delays in transmission

git-svn-id: https://svn.fhem.de/fhem/trunk@6279 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2014-07-20 06:28:10 +00:00
parent 5173ad100d
commit 964bf46a80
2 changed files with 15 additions and 15 deletions

View File

@ -900,7 +900,7 @@ sub HMLAN_qResp($$$) {#response-waiting queue##################################
$hashQ->{answerPend} ++; $hashQ->{answerPend} ++;
push @{$hashQ->{apIDs}},$id; push @{$hashQ->{apIDs}},$id;
if ($hashQ->{answerPend} >= $hashQ->{hmLanQlen}){ if ($hashQ->{answerPend} >= $hashQ->{hmLanQlen}){
$hash->{XmitOpen} = 0; $hash->{XmitOpen} = 2;#delay further sending
InternalTimer(gettimeofday()+10, "HMLAN_clearQ", "hmClearQ:$hash->{NAME}", 0); InternalTimer(gettimeofday()+10, "HMLAN_clearQ", "hmClearQ:$hash->{NAME}", 0);
} }
} }
@ -908,11 +908,11 @@ sub HMLAN_qResp($$$) {#response-waiting queue##################################
$hashQ->{answerPend}-- if ($hashQ->{answerPend}>0); $hashQ->{answerPend}-- if ($hashQ->{answerPend}>0);
@{$hashQ->{apIDs}}=grep !/$id/,@{$hashQ->{apIDs}}; @{$hashQ->{apIDs}}=grep !/$id/,@{$hashQ->{apIDs}};
RemoveInternalTimer("hmClearQ:$hash->{NAME}")if ($hash->{XmitOpen} == 0); RemoveInternalTimer("hmClearQ:$hash->{NAME}")if ($hash->{XmitOpen} == 0);
$hash->{XmitOpen} = 1
if (($hashQ->{answerPend} < $hashQ->{hmLanQlen}) && if ($hashQ->{HMcndN} == 4 ||
!($hashQ->{HMcndN} == 4 || $hashQ->{HMcndN} == 253){ $hash->{XmitOpen} = 0;}
$hashQ->{HMcndN} == 253) elsif($hashQ->{answerPend} >= $hashQ->{hmLanQlen}){$hash->{XmitOpen} = 2;}
); else{ $hash->{XmitOpen} = 1;}
} }
} }
sub HMLAN_clearQ($) {#clear pending acks due to timeout######################## sub HMLAN_clearQ($) {#clear pending acks due to timeout########################
@ -932,8 +932,9 @@ sub HMLAN_condUpdate($$) {#####################################################
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $hashCnd = $hash->{helper}{cnd};#short to helper my $hashCnd = $hash->{helper}{cnd};#short to helper
my $hashQ = $hash->{helper}{q};#short to helper my $hashQ = $hash->{helper}{q};#short to helper
$hashCnd->{$HMcnd} = 0 if (!$hashCnd->{$HMcnd}); $hash->{helper}{cnd}{$HMcnd} = 0 if (!$hash->{helper}{cnd} ||
$hashCnd->{$HMcnd}++; !$hash->{helper}{cnd}{$HMcnd});
$hash->{helper}{cnd}{$HMcnd}++;
if ($HMcnd == 4){#HMLAN needs a rest. Supress all sends exept keep alive if ($HMcnd == 4){#HMLAN needs a rest. Supress all sends exept keep alive
$hash->{STATE} = "overload"; $hash->{STATE} = "overload";
} }
@ -945,8 +946,8 @@ sub HMLAN_condUpdate($$) {#####################################################
my $HMcndTxt = $HMcond{$HMcnd}?$HMcond{$HMcnd}:"Unknown:$HMcnd"; my $HMcndTxt = $HMcond{$HMcnd}?$HMcond{$HMcnd}:"Unknown:$HMcnd";
Log3 $hash, 1, "HMLAN_Parse: $name new condition $HMcndTxt"; Log3 $hash, 1, "HMLAN_Parse: $name new condition $HMcndTxt";
my $txt; my $txt;
$txt .= $HMcond{$_}.":".$hashCnd->{$_}." " $txt .= $HMcond{$_}.":".$hash->{helper}{cnd}{$_}." "
foreach (keys%{$hashCnd}); foreach (keys%{$hash->{helper}{cnd}});
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
readingsBulkUpdate($hash,"cond",$HMcndTxt); readingsBulkUpdate($hash,"cond",$HMcndTxt);
@ -970,8 +971,7 @@ sub HMLAN_condUpdate($$) {#####################################################
$hash->{XmitOpen} = 0; #deny transmit $hash->{XmitOpen} = 0; #deny transmit
} }
else{ else{
$hash->{XmitOpen} = 1 $hash->{XmitOpen} = ($hashQ->{answerPend} < $hashQ->{hmLanQlen})?"1":"2";#allow transmit
if($hashQ->{answerPend} < $hashQ->{hmLanQlen});#allow transmit
} }
readingsEndUpdate($hash,1); readingsEndUpdate($hash,1);
my $ccu = InternalVal($name,"owner_CCU",""); my $ccu = InternalVal($name,"owner_CCU","");

View File

@ -4835,7 +4835,7 @@ sub CUL_HM_sndIfOpen($) {
RemoveInternalTimer("sndIfOpen:$io");# should not be necessary, but RemoveInternalTimer("sndIfOpen:$io");# should not be necessary, but
my $ioHash = $defs{$io}; my $ioHash = $defs{$io};
if ( $ioHash->{STATE} !~ m/^(opened|Initialized)$/ if ( $ioHash->{STATE} !~ m/^(opened|Initialized)$/
||(defined $ioHash->{XmitOpen} && $ioHash->{XmitOpen} == 0) ||(defined $ioHash->{XmitOpen} && $ioHash->{XmitOpen} != 1)
# ||$modules{CUL_HM}{prot}{rspPend}>=$maxPendCmds # ||$modules{CUL_HM}{prot}{rspPend}>=$maxPendCmds
){#still no send allowed ){#still no send allowed
if ($modules{CUL_HM}{$io}{tmrStart} < gettimeofday() - $modules{CUL_HM}{hmIoMaxDly}){ if ($modules{CUL_HM}{$io}{tmrStart} < gettimeofday() - $modules{CUL_HM}{hmIoMaxDly}){
@ -4881,7 +4881,7 @@ sub CUL_HM_SndCmd($$) {
if ( $io->{STATE} !~ m/^(opened|Initialized)$/ # we need to queue if ( $io->{STATE} !~ m/^(opened|Initialized)$/ # we need to queue
||(hex substr($cmd,2,2) & 0x20) && ( # check for commands with resp-req ||(hex substr($cmd,2,2) & 0x20) && ( # check for commands with resp-req
$modules{CUL_HM}{$ioName}{tmr} # queue already running $modules{CUL_HM}{$ioName}{tmr} # queue already running
||(defined $io->{XmitOpen} && $io->{XmitOpen} == 0)#overload, dont send ||(defined $io->{XmitOpen} && $io->{XmitOpen} != 1)#overload, dont send
) )
){ ){