Skip to content

Commit

Permalink
refactor: _receivedCallback is a more accurate name
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbubu committed Nov 5, 2020
1 parent 65191ff commit 61961fe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/mesh-stream/port-stream/mesh-read-man.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface MeshReadManOptions {
export class MeshReadMan<Out> {
private _buffer: Out[] = []
private _requestList: MeshRead<Out>[] = []
private _readCallback: OnReceivedCallback | null = null
private _receivedCallback: OnReceivedCallback | null = null
private _timerId: NodeJS.Timeout | null = null
private _endOrError: pull.EndOrError = null
private _abort: pull.EndOrError = null
Expand Down Expand Up @@ -50,7 +50,7 @@ export class MeshReadMan<Out> {
return readCb(true)
}

this._readCallback = readCb
this._receivedCallback = readCb
this._buffer.push(data)

if (this.drainAbort()) return
Expand Down Expand Up @@ -178,9 +178,9 @@ export class MeshReadMan<Out> {
}
}
// should we read more data to fill the buffer?
if (this._buffer.length < DefaultWindowSize && this._readCallback) {
const t = this._readCallback
this._readCallback = null
if (this._buffer.length < DefaultWindowSize && this._receivedCallback) {
const t = this._receivedCallback
this._receivedCallback = null
t()
}
}
Expand Down

0 comments on commit 61961fe

Please sign in to comment.