-
Notifications
You must be signed in to change notification settings - Fork 2
Description
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
ConnectionPoolsingleton class - Merge connection instance classes into one
PeerConnectionclass - Support inbound and outbound communication using the same socket
- Make sure initialization of the
ConnectionPoolonly 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