spacemeshos / go-spacemesh

Go Implementation of the Spacemesh protocol full node. 💾⏰💪
https://spacemesh.io
MIT License
765 stars 214 forks source link

[Merged by Bors] - p2p: server: fix incorrect bufio usage #6470

Closed ivan4th closed 1 week ago

ivan4th commented 1 week ago

Motivation

It is not correct to use bufio.Buffer to read the initial request and then passing the underlying stream to the StreamRequest callback, as bufio.Buffer may happen to read more data than necessary, making it unavailable for the StreamRequest callback. This behavior has been obvserved when using QUIC, which tends to coalesce multiple writes more often.

Description

This removes unneeded bufio.Buffer usage, which should not impact performance as the buffer was not being used for the actual request handling, anyway.

Test Plan

Verified that this fixes QUIC write coalescing issue.

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.9%. Comparing base (86ac1f4) to head (4211315). Report is 1 commits behind head on develop.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #6470 +/- ## ========================================= - Coverage 79.9% 79.9% -0.1% ========================================= Files 353 353 Lines 46432 46435 +3 ========================================= - Hits 37122 37113 -9 - Misses 7210 7219 +9 - Partials 2100 2103 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features:

ivan4th commented 1 week ago

bors merge

spacemesh-bors[bot] commented 1 week ago

Pull request successfully merged into develop.

Build succeeded: