Skip to content

Commit 0c2bbba

Browse files
authored
fix: use min built-in for segment payload size (#1015)
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
1 parent b40b921 commit 0c2bbba

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

protocol/protocol.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,7 @@ func (p *Protocol) sendLoop() {
305305
// Send messages in multiple segments (if needed)
306306
for {
307307
// Determine segment payload length
308-
segmentPayloadLength := payloadBuf.Len()
309-
if segmentPayloadLength > muxer.SegmentMaxPayloadLength {
310-
segmentPayloadLength = muxer.SegmentMaxPayloadLength
311-
}
308+
segmentPayloadLength := min(payloadBuf.Len(), muxer.SegmentMaxPayloadLength)
312309
// Send current segment
313310
segmentPayload := payloadBuf.Bytes()[:segmentPayloadLength]
314311
isResponse := p.Role() == ProtocolRoleServer

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy