HomePhabricator
Diffusion Comm 3e292a36a696

[Tunnelbroker] implement socket Heartbeats

Description

[Tunnelbroker] implement socket Heartbeats

Summary:
Heartbeats algorithm:

  1. Tunnelbroker after receiving any message from clients starts to wait for SOCKET_HEARTBEAT_TIMOUT time interval.
  2. If there is SOCKET_HEARTBEAT_TIMOUT time without a message - send Heartbeat and start waiting again.
  3. If Heartbeat was sent and there is another SOCKET_HEARTBEAT_TIMOUT time interval without any response - consider the connection unhealthy and close the socket.

From the client side:

  1. If there is any message from Tunnelbroker start waiting CLIENT_SOCKET_HEARTBEAT_TIMOUT.
  2. If there was more than CLIENT_SOCKET_HEARTBEAT_TIMOUT from the last message consider the connection unhealthy and close the socket.

CLIENT_SOCKET_HEARTBEAT_TIMOUT should be at least 2x SOCKET_HEARTBEAT_TIMOUT

This diff:

  1. Adds new types
  2. Adds logic for heartbeats
  3. Implements tests exclusive for Heartbeats
  4. Make sure heartbeats will not interfere with different tests

Depends on D9618

Test Plan: Tests

Reviewers: michal, bartek, varun, jon

Reviewed By: michal

Subscribers: ashoat, tomek, wyilio

Differential Revision: https://phab.comm.dev/D9630

Details

Provenance
kamilAuthored on Oct 30 2023, 7:00 AM
Reviewer
michal
Differential Revision
D9630: [Tunnelbroker] implement socket Heartbeats
Parents
rCOMMa639d04ed525: [keyserver] implement socket and update code to interact with Tunnelbroker API
Branches
Unknown
Tags
Unknown