takeshixx/knxmap

Timeout on connection lost

MaxXor opened this issue · 3 comments

Hi, is there any configurable timeout when knxmap loses the connection to the KNX/IP Gateway? Currently when you start knxmap in bus monitor mode and then disconnect the gateway by unplugging the cable knxmap is basically stuck forever. Is there any option for timeout or reconnect on timeout?

Running the bus monitor does not establish a session because KNXnet/IP is based on UDP. The client will most likely not know if a gateway drops the connection. Introducing a timeout would be a potential solution. However, it might not make much sense to have one by default.
There should be some kind of keep alive for the tunnel connection, but I have to look into the bus monitor to see if it will indeed kill the connection after some extended amount of time.

@takeshixx Yes, that would be awesome.

Look here:

# After receiving a CONNECTIONSTATE_RESPONSE schedule the next one
self.loop.call_later(50, self.knx_keep_alive)

I think a possible solution would be after sending the next keepalive packet, start a timer that checks if within the next X seconds no response is received, the connection should be restarted?