Skip to content

NodeConnectionManager manages remote initiated connections #527

@tegefaulkes

Description

@tegefaulkes

Specification

With the creation and integration of @matrixai/js-quic, the concept of a connection is now generic to forward and reverse initiated connections. This means, no matter who initiated the connection, streams can be created in either direction.

Previously the NodeConnectionManager only managed forward initiated connections. Now it should be able to handle reverse connections and add them to the connection map. This is essential for re-using connections efficiently.

The NodeConnection needs to be updated to be able to wrap QUICConnections coming out of the QUICServer. This will be a new async creation method. The cleanup logic will need to switch based on if it was a forward connection with a QUICClient or a reverse connection.

The QUICServer needs to be moved into and managed by the NodeConnectionManager. It's lifecycle will be fully managed. I don't know if we want to be able to DI it.

Reverse connections coming out of the QUICServer needs to be handled, wrapped in a NodeConnection and added into the connection map. There may be some complexities with locking here, that still needs to be prototyped.

All reverse stream events coming out of the QUICConnectons need to be handled by the RPCServer via a handleStream callback.

Additional context

Tasks

  • 1. Update NodeConnection to wrap reverse created QUICStreams and handle clean up in all cases. QUICClient can be optional and needs to be handled.
  • 2. QUICServer needs to be moved and managed by NodeConnectionManager
  • 3. Reverse connections coming from the QUICServer needs to be handled and put into the connection map.
  • 4. Reverse streams from all QUICConnections needs to be handled by a RPCServer via a handleStream callback.
  • 5. Tests need to be expanded and updated to handle new behaviour

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions