Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix infinite loop in single-stream connection #2751

Merged
merged 6 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bin/wasm-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Fixed

- Fix potential infinite loop in networking connection task. ([#2751](https://github.com/paritytech/smoldot/pull/2751))

## 0.6.33 - 2022-09-13

### Added
Expand Down
11 changes: 7 additions & 4 deletions src/libp2p/connection/established/single_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,14 @@ where

if let Some(event) = event {
return Ok((self, Some(event)));
} else if num_read == 0 {
// Substream doesn't accept anymore data because it is blocked on writing out.
return Ok((self, None))
} else {
// Jump back to the beginning of the loop. We don't want to read more data
// until this specific substream's data has been processed.
continue;
}

// Jump back to the beginning of the loop. We don't want to read more data until
// this specific substream's data has been processed.
continue;
}

// Transfer data from `incoming_data` to the internal buffer in `self.encryption`.
Expand Down