fix streamsocket write-length calculation

Authored by sitter on Aug 12 2019, 12:11 PM.



TrafficShapedSocket::write has a somewhat narrow contract with its caller.
max may be 0 or >0, 0 meaning no limit, >0 meaning limit.
this was incorrectly implemented before where we'd assume max means always
limit, resulting in unlimited calls always resulting in 0 data getting
sent as max would be 0.

the revised code explicitly handles 0 meaning no limit. this is in line
with the behavior of PacketSocket, the only other implementation of
a shaped socket.

BUG: 382375

Test Plan

webseeds start working by default and download at full bandwith

Diff Detail

R472 KTorrent Library
No Linters Available
No Unit Test Coverage
Build Status
Buildable 15022
Build 15040: arc lint + arc unit
sitter requested review of this revision.Aug 12 2019, 12:11 PM
sitter created this revision.
stikonas accepted this revision.Aug 12 2019, 7:01 PM
This revision is now accepted and ready to land.Aug 12 2019, 7:01 PM
This revision was automatically updated to reflect the committed changes.

[spam comment removed by sysadmin]

[spam comment removed by sysadmin]