Skip to content

Rewrite OmniProtocol socket management #683

@linear

Description

@linear

Currently sockets are managed in multiple classes. We have a class to handle inbound connections and another to handle outbound connections. We also have another class to handle rate limiting. These classes are initialized all over creating a crack in sockets and peer connection management.

Configuration is also very chaotic and we have differing defaults being passed everywhere these classes are initialized. The config values for rate limits are disconnected between inbound and inbound connections too. This makes it hard to figure out which instance is being used where, especially when it comes to rate limiting.

Outbound connections are solely used to send outbound messages and inbound connections are used to receive inbound messages. This is not very efficient as we can reuse a single socket to do bidirectional communication.

The plan is to:

  • Merge all socket management classes into one ConnectionPool singleton class
  • Merge connection instance classes into one PeerConnection class
  • Support inbound and outbound communication using the same socket
  • Make sure initialization of the ConnectionPool only happens once and subsequent references use that instance
  • Centralize omniprotocol and rate limiting configuration by moving it to SharedState
  • Lower rate limits to a max of 2 connections to a peer: 1 main connection and a backup in case the main goes down
  • Test out all that!
  • Ask testers to restart their nodes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions