Skip to content

Commit

Permalink
fix: disconnects should now work again on unix based systems (#2120)
Browse files Browse the repository at this point in the history
  • Loading branch information
reconbot committed Aug 7, 2020
1 parent f88c75e commit 2801301
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/bindings/lib/unix-read.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const unixRead = async ({ binding, buffer, offset, length, fsReadAsync = readAsy
err.errno === -1 // generic error

if (disconnectError) {
err.canceled = true
err.disconnect = true
logger('disconnecting', err)
}

Expand Down
4 changes: 2 additions & 2 deletions packages/bindings/lib/unix-read.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ describe('unixRead', () => {
const err = await shouldReject(unixRead({ binding: mock, buffer: readBuffer, offset: 0, length: 8, fsReadAsync }))
assert.isTrue(err.canceled)
})
it('rejects a canceled error when fsread errors a disconnect error', async () => {
it('rejects a disconnected error when fsread errors a disconnect error', async () => {
const readBuffer = Buffer.alloc(8, 0)
const fsReadAsync = makeFsReadError('EBADF')
const err = await shouldReject(unixRead({ binding: mock, buffer: readBuffer, offset: 0, length: 8, fsReadAsync }))
assert.isTrue(err.canceled)
assert.isTrue(err.disconnect)
})
})

0 comments on commit 2801301

Please sign in to comment.