]> git.basschouten.com Git - openhab-addons.git/commit
[gardena] Fix server ping timeout logic (#14203)
authormaniac103 <dannybaumann@web.de>
Wed, 11 Jan 2023 14:05:19 +0000 (15:05 +0100)
committerGitHub <noreply@github.com>
Wed, 11 Jan 2023 14:05:19 +0000 (15:05 +0100)
commitf16f52487782474c3cba41af42c1a91cb86a734d
tree2b4e0e0fa8f727e4a4e91b895051f882c01f52bd
parent858ff4b2441debe7f6286a92728ca805644747f7
[gardena] Fix server ping timeout logic (#14203)

On server timeouts, it's possible for multiple minutes to elapse
between receiving the last pong on the old connection and attempting to
send the next ping on the new connection. If that time span exceeded 5
minutes, the binding went into a minutely reconnection loop, because it
never attempted to send a ping anymore, which led to lastPong not being
updated anymore.
To fix this, replace the timing dependent timestamp handling by a simple
counter which counts how many consecutive ping attempts didn't receive
an answer, and closing the connection after 5 unsuccessful ping
attempts. That new counter is now also reset whenever the connection is
restarted.

Fixes #14188

Signed-off-by: Danny Baumann <dannybaumann@web.de>
bundles/org.openhab.binding.gardena/src/main/java/org/openhab/binding/gardena/internal/GardenaSmartWebSocket.java