Skip to content

webrtc: Gracefully close substreams #476

@haikoschol

Description

@haikoschol

The libp2p WebRTC transport uses a protobuf message containing the payload and flags for signaling (half-)closing and resets of substreams.

The litep2p implementation does not set these flags when a substream is closed.

Strictly speaking, to be fully spec compliant, closing a substream should perform the following steps:

  1. Stop accepting new data to send out.
  2. Ensure that all pending data has been sent (flush).
  3. Ideally, in the last protobuf message used for 2., set the FIN flag. Otherwise send a protobuf message with an empty payload.
  4. Wait for the remote to respond with a FIN_ACK.
  5. Close the underlying WebRTC data channel (DirectApi::close_data_channel())
  6. Drop all resources associated with the substream.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions