Skip to content

fix(simplerouter): use write_all instead of write in send_data#1042

Open
de-sh wants to merge 1 commit into
bytebeamio:mainfrom
de-sh:fix/write_all
Open

fix(simplerouter): use write_all instead of write in send_data#1042
de-sh wants to merge 1 commit into
bytebeamio:mainfrom
de-sh:fix/write_all

Conversation

@de-sh
Copy link
Copy Markdown
Contributor

@de-sh de-sh commented Apr 6, 2026

AsyncWriteExt::write can perform partial writes when the TCP send buffer is under pressure. send_data silently discarded the byte count and returned early, so PUBACK and CONNACK packets were silently truncated under benchmark load. The client saw malformed frames, disconnected, and reconnected in a loop, making throughput numbers meaningless and profiling data invalid.

Switches to write_all, which retries internally until every byte is sent or returns an error if it fails.

Type of change

Checklist:

  • Formatted with cargo fmt
  • Make an entry to CHANGELOG.md if it's relevant to the users of the library. If it's not relevant mention why.

AsyncWriteExt::write can perform partial writes when the TCP send
buffer is under pressure. send_data silently discarded the byte count
and returned Ok(()), so PUBACK and CONNACK packets were silently
truncated under benchmark load. The client saw malformed framing,
disconnected, and reconnected in a loop — making throughput numbers
meaningless and profiling data invalid.

Switch to write_all, which retries internally until every byte is sent
or returns an error.
@de-sh de-sh changed the title fix(simplerouter): use write_all instead of write in send_data fix(simplerouter): use write_all instead of write in send_data Apr 6, 2026
@de-sh de-sh marked this pull request as ready for review April 6, 2026 05:39
thehouseisonfire added a commit to thehouseisonfire/rumqtt that referenced this pull request Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant