paritytech / paritytech/litep2p
substreams: Allow substreams to close without consuming self
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 161
- Forks
- 38
- Avg merge
- 13h 43m
- Merged PRs (30d)
- 12
Description
The current implementation consumes self when calling the close method on the substream.
After the close is called, the substream's end user should no longer write data into it.
This is a bit restrictive because the substream can be drained/read after the close call.
It is entirely possible to have the following scenario:
- Write data to the substream
- Substream close (signals the receiver end via read bytes number = 0)
- Read data from the substream
One such implementation is the /perf/1.0.0 protocol from rust-libp2p.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/substream/mod.rs around line 339 and inspect the substream close method and its read/drain lifecycle. Reproduce the sequence of writing data, closing the substream, and then reading it. Done means close signals the receiver while still allowing already-written data to be drained afterward.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100