Skip to content

Commit

Permalink
Touch-up code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Aug 23, 2024
1 parent 86a8985 commit 026821f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/nerdbank-streams/src/Channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export class ChannelClass extends Channel {

// We should find a way to detect when we *actually* share the received buffer with the Channel's user
// and only report consumption when they receive the buffer from us so that we effectively apply
// backpressure to the remote party based on our user's actual consumption rather than keep allocating memory.
// backpressure to the remote party based on our user's actual consumption rather than continually allocating memory.
if (this._multiplexingStream.backpressureSupportEnabled && buffer) {
this._multiplexingStream.localContentExamined(this, buffer.length)
}
Expand Down
8 changes: 4 additions & 4 deletions src/nerdbank-streams/src/Utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ export async function getBufferFrom(
throw new Error('Stream terminated before required bytes were read.')
}

// Returns what has been read so far
// Returns what has been read so far.
if (readBuffer === null) {
return null
}

// we need trim extra spaces
// We need to trim the trailing space.
return readBuffer.subarray(0, index)
}

Expand All @@ -116,11 +116,11 @@ export async function getBufferFrom(

if (readBuffer === null) {
if (availableSize === size || newBuffer.length < availableSize) {
// in the fast pass, we read the entire data once, and donot allocate an extra array.
// In the fast pass, we read the entire data once, and do not allocate an extra array.
return newBuffer
}

// if we read partial data, we need allocate a buffer to join all data together.
// If we read partial data, we need to allocate a buffer to join all data together.
readBuffer = Buffer.alloc(size)
}

Expand Down

0 comments on commit 026821f

Please sign in to comment.