digidem / mapeo-core-next

The upcoming version of Mapeo Core
MIT License
7 stars 1 forks source link

feat: detect closed connections with TCP keepalive #712

Closed EvanHahn closed 1 week ago

EvanHahn commented 1 week ago

If two peers connect and one disconnects, the other won't necessarily know.

  1. Alex and Charlie connect. Alex sees that they are connected to 1 device.
  2. Charlie disconnects from wifi. Alex still sees a connection to 1 device, even though the connection should be broken.

We can fix this in several ways. I think the best is to enable TCP keepalive, which effectively sends a packet every second asking, "is this connection still on?".

I did not add unit tests for this (I could not think of a good way) but did test manually in CoMapeo with two Android devices.