Skip to content

Commit 88f03d5

Browse files
committed
Revert "credentials/alts: Add comments to clarify buffer sizing (grpc#8232)"
This reverts commit be25d96.
1 parent 25c7509 commit 88f03d5

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

credentials/alts/internal/conn/record.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,7 @@ func (p *conn) Read(b []byte) (n int, err error) {
166166
panic(fmt.Sprintf("protected buffer length shorter than expected: %d vs %d", len(p.protected), MsgLenFieldSize))
167167
}
168168
oldProtectedBuf := p.protected
169-
// The new buffer must be able to hold the message length header
170-
// and the entire message.
171-
requiredCapacity := int(length) + MsgLenFieldSize
172-
p.protected = make([]byte, requiredCapacity)
173-
// Copy the contents of the old buffer and set the length of the
174-
// new buffer to the number of bytes already read.
169+
p.protected = make([]byte, int(length)+MsgLenFieldSize)
175170
copy(p.protected, oldProtectedBuf)
176171
p.protected = p.protected[:len(oldProtectedBuf)]
177172
}

0 commit comments

Comments
 (0)