Skip to content
This repository has been archived by the owner on Feb 26, 2021. It is now read-only.

Commit

Permalink
fix: handle error on .end (#85)
Browse files Browse the repository at this point in the history
chore: use travis

License: MIT
Signed-off-by: Jacob Heun <[email protected]>
  • Loading branch information
jacobheun authored Mar 18, 2019
1 parent 0f87e6e commit f5af587
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 10 deletions.
42 changes: 42 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
language: node_js
cache: npm
stages:
- check
- test
- cov

node_js:
- '10'

os:
- linux
- osx

script: npx nyc -s npm run test:node -- --bail
after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov

jobs:
include:
- os: windows
cache: false

- stage: check
script:
- npx aegir commitlint --travis
- npx aegir dep-check
- npm run lint

- stage: test
name: chrome
addons:
chrome: stable
script: npx aegir test -t browser -t webworker

- stage: test
name: firefox
addons:
firefox: latest
script: npx aegir test -t browser -t webworker -- --browsers FirefoxHeadless

notifications:
email: false
2 changes: 0 additions & 2 deletions ci/Jenkinsfile

This file was deleted.

15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,26 @@
"npm": ">=3.0.0"
},
"devDependencies": {
"aegir": "^17.1.1",
"aegir": "^18.2.1",
"chai": "^4.2.0",
"chai-checkmark": "^1.0.1",
"dirty-chai": "^2.0.1",
"interface-stream-muxer": "~0.6.0",
"libp2p-tcp": "~0.13.0",
"libp2p-websockets": "~0.12.0",
"multiaddr": "^6.0.0",
"libp2p-websockets": "~0.12.2",
"multiaddr": "^6.0.6",
"pull-file": "^1.1.0",
"pull-pair": "^1.1.0",
"run-parallel": "^1.1.9",
"sinon": "^7.1.0",
"sinon": "^7.2.7",
"tap-spec": "^4.1.1",
"tape": "^4.9.0"
"tape": "^4.10.1"
},
"dependencies": {
"debug": "^4.1.0",
"debug": "^4.1.1",
"interface-connection": "~0.3.3",
"pull-catch": "^1.0.0",
"once": "^1.4.0",
"pull-catch": "^1.0.1",
"pull-stream": "^3.6.9",
"pull-stream-to-stream": "^1.3.4",
"spdy-transport": "^3.0.0",
Expand Down
6 changes: 5 additions & 1 deletion src/muxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const Connection = require('interface-connection').Connection
const toPull = require('stream-to-pull-stream')
const pullCatch = require('pull-catch')
const pull = require('pull-stream')
const once = require('once')
const noop = () => {}
const debug = require('debug')
const log = debug('spdy')
Expand Down Expand Up @@ -102,7 +103,10 @@ module.exports = class Muxer extends EventEmitter {
}

end (cb) {
cb = cb || noop
cb = once(cb || noop)
this.spdy.once('error', (err) => {
cb(err)
})
this.spdy.end((err) => {
if (err && /ok/i.test(err.message)) {
return cb()
Expand Down

0 comments on commit f5af587

Please sign in to comment.