Skip to content

Conversation

@lexnv
Copy link
Collaborator

@lexnv lexnv commented Jan 19, 2026

This PR replaces the io.write with io.write_all calls to ensure the negotiation messages are fully propagated.

  • There was a bug in the fn handshake implementation, which might propagate only a part of the provided negotiation message (ie on partial writes the write call would return immediately)
  • This would then be rejected by the other side, causing unnecessary negotiation errors while opening the connection
  • The downstream effect of this is that higher level protocols (like notification protocols) would backoff the peer for ~5s.

@lexnv lexnv self-assigned this Jan 19, 2026
@lexnv lexnv added the bug Something isn't working label Jan 19, 2026
Copy link
Collaborator

@dmitry-markin dmitry-markin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@lexnv lexnv merged commit e8d93ef into master Jan 20, 2026
8 checks passed
@lexnv lexnv deleted the lexnv/fix-negotiation branch January 20, 2026 10:15
dmitry-markin added a commit that referenced this pull request Jan 21, 2026
## [0.13.0] - 2026-01-21

This release brings multiple fixes to both the transport and
application-level protocols.

Specifically, it enhances WebSocket stability by resolving AsyncWrite
errors and ensuring that partial writes during the negotiation phase no
longer trigger connection failures.

At the same time, Bitswap client functionality is introduced, which
makes this release semver breaking.

### Added

- Add Bitswap client
([#501](#501))

### Fixed

- notif/fix: Avoid CPU busy loops on litep2p full shutdown
([#521](#521))
- protocol: Ensure transport manager knows about closed connections
([#515](#515))
- substream: Decrement the bytes counter to avoid excessive flushing
([#511](#511))
- crypto/noise: Improve stability of websockets by fixing AsyncWrite
implementation ([#518](#518))
- bitswap: Split block responses into batches under 2 MiB
([#516](#516))
- crypto/noise: Fix connection negotiation logic on partial writes
([#519](#519))
- substream/fix: Fix partial reads for ProtocolCodec::Identity
([#512](#512))
- webrtc: Avoid panics returning error instead
([#509](#509))
- bitswap: e2e test & max payload fix
([#508](#508))
- tcp: Exit connections when events fail to propagate to protocols
([#506](#506))
- webrtc: Avoid future being dropped when channel is full
([#483](#483))

---------

Co-authored-by: Alexandru Vasile <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants