Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Aug 26, 2021
1 parent 61c4bb8 commit 2baa94a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const fs = require('fs')
const EventEmitter = require('events')
const inherits = require('util').inherits
const path = require('path')
const assert = require('assert')

const BUSY_WRITE_TIMEOUT = 100

Expand Down Expand Up @@ -230,7 +229,7 @@ SonicBoom.prototype.write = function (data) {
if (!this._writing && len > this.minLength) {
actualWrite(this)
}
return !this._writing
return len < 16384
}

SonicBoom.prototype.flush = function () {
Expand Down Expand Up @@ -346,9 +345,6 @@ SonicBoom.prototype.destroy = function () {
}

function actualWrite (sonic) {
assert(!sonic._writing)
assert(sonic._buf.length <= MAX_WRITE)

sonic._writing = true
const buf = sonic._buf
sonic._buf = ''
Expand All @@ -371,7 +367,7 @@ function actualClose (sonic) {
sonic.once('ready', actualClose.bind(null, sonic))
return
}
if (this._writing) {
if (sonic._writing) {
sonic.once('drain', actualClose.bind(null, sonic))
return
}
Expand Down

0 comments on commit 2baa94a

Please sign in to comment.