From 131d430d95b5560e1a967a72c3fddb04029d24dd Mon Sep 17 00:00:00 2001 From: mgehre <> Date: Wed, 13 Feb 2013 23:34:54 +0000 Subject: [PATCH] CUL_MAX: if Ack comes faster than ackTimeout, continue sending git-svn-id: https://svn.fhem.de/fhem/trunk@2722 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/14_CUL_MAX.pm | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/fhem/FHEM/14_CUL_MAX.pm b/fhem/FHEM/14_CUL_MAX.pm index 334cf5f8f..ea84b8b64 100644 --- a/fhem/FHEM/14_CUL_MAX.pm +++ b/fhem/FHEM/14_CUL_MAX.pm @@ -323,15 +323,22 @@ CUL_MAX_SendQueueHandler($) } else { IOWrite($hash, "", "Zs". $packet->{packet}); $packet->{sent} = 1; - $timeout += $ackTimeout; #reschedule after ackTimeout + $packet->{sentTime} = gettimeofday(); + $timeout += 0.5; #recheck for Ack } - } elsif( $packet->{sent} == 1) { #Already sent it, got no Ack - Log 2, "CUL_MAX_Resend: Missing ack from $packet->{dest} for $packet->{packet}"; - splice @{$hash->{sendQueue}}, 0, 1; #Remove from array - readingsSingleUpdate($hash, "packetsLost", ReadingsVal($hash->{NAME}, "packetsLost", 0) + 1, 1); + } elsif( $packet->{sent} == 1 ) { #Already sent it, got no Ack + if( $packet->{sentTime} + $ackTimeout < gettimeofday() ) { + # ackTimeout exceeded + Log 2, "CUL_MAX_Resend: Missing ack from $packet->{dest} for $packet->{packet}"; + splice @{$hash->{sendQueue}}, 0, 1; #Remove from array + readingsSingleUpdate($hash, "packetsLost", ReadingsVal($hash->{NAME}, "packetsLost", 0) + 1, 1); + } else { + # Recheck for Ack + $timeout += 0.5; + } - } elsif( $packet->{sent} == 2) { #Got ack + } elsif( $packet->{sent} == 2 ) { #Got ack splice @{$hash->{sendQueue}}, 0, 1; #Remove from array }