Skip to content

4.1.1 Tunnel robustness

Latest

Choose a tag to compare

@farmio farmio released this 05 Nov 21:40
· 8 commits to main since this release
e3d8212

Connection

  • XKNX.stop() no longer hangs until the gateway is reachable again when the tunnel is reconnecting and a telegram is waiting to be sent: reconnecting is stopped before the outgoing queue is drained (new Interface.stop_reconnect()), so a pending telegram fails with CommunicationError instead of waiting for the reconnect. Telegrams queued while the connection is up are still sent before disconnecting.
  • Cancelling a task that sends a telegram while the tunnel is reconnecting (e.g. a timeout around xknx.telegrams.put consumers or shutdown) no longer cancels the reconnect itself, which left the tunnel disconnected for good.
  • Tunnel: a TUNNELLING_REQUEST of another communication channel is discarded without an ACK and without touching the incoming sequence counter, and a DISCONNECT_REQUEST of another communication channel is answered with E_CONNECTION_ID instead of closing our tunnel - KNX v01.06.02 - Core 03.08.02 - §5.3.3, §7.8.4.
  • Tunnel: a TUNNELLING_ACK or DEVICE_CONFIGURATION_ACK only confirms the request with the same communication channel and sequence counter. A stale ACK of a repeated frame no longer confirms the next frame, which silently got lost.
  • UDP tunnel: a telegram whose TUNNELLING_REQUESTs went unanswered while the heartbeat already reconnected the tunnel is retried on the new communication channel instead of reconnecting the healthy new tunnel once more.
  • TCP tunnel: a connection lost while connect() still waits for the CONNECT_RESPONSE or the secure session handshake no longer leaves an orphaned reconnect loop behind the failed connection attempt.
  • Tunnel: the automatic reconnect keeps retrying after an unexpected exception instead of ending silently with the tunnel disconnected.
  • TCP transport: a partial frame left in the receive buffer is dropped when the connection is closed or reopened instead of corrupting the first frame of the next connection.
  • TCP transport: establishing the TCP connection times out after TCP_CONNECT_TIMEOUT (10 seconds) with a CommunicationError instead of waiting for the OS connect timeout (~2 minutes for a dropped SYN).

Management

  • P2PConnection.send_data() repeats a telegram the device doesn't acknowledge up to 3 times instead of once - max_rep_count of KNX v01.02.03 - Transport Layer 03.03.04 - §4, used by events E17/E18 of §5.3. A telegram lost twice in a row on a busy or lossy path, e.g. a KNXnet/IP tunnel, no longer fails the request. MANAGEMENT_MAX_REPETITIONS holds the number. A device that doesn't answer at all is given up on after 12 seconds instead of 6, which also makes nm_individual_address_check() and nm_individual_address_write() wait that long for a free address.

Bugfixes

  • StateUpdater: RemoteValues sharing a state address - e.g. a Sensor and a Climate configured with the same group_address_*_state - are read with a single GroupValueRead. The others wait for that read instead of sending their own, since its response is processed by every RemoteValue of the address anyway.