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

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
This commit is contained in:
mgehre 2013-02-13 23:34:54 +00:00
parent 7f2d4040bd
commit 131d430d95

View File

@ -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
}