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

Commit

Permalink
fix: destroy connection when the underlying connection ends
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire authored and daviddias committed Sep 6, 2016
1 parent 3ce7409 commit 4d23827
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "libp2p-spdy",
"version": "0.8.1",
"description": "SPDY 3.1 implementation wrapper that is compatible with libp2p Stream Muxer expected interface",
"main": "src/index.js",
"main": "lib/index.js",
"jsnext:main": "src/index.js",
"scripts": {
"lint": "gulp lint",
Expand Down Expand Up @@ -34,11 +34,11 @@
},
"homepage": "https://github.com/libp2p/js-libp2p-spdy",
"devDependencies": {
"aegir": "^6.0.0",
"aegir": "^6.0.1",
"chai": "^3.5.0",
"interface-stream-muxer": "^0.3.1",
"libp2p-tcp": "^0.7.4",
"libp2p-websockets": "^0.7.1",
"libp2p-tcp": "^0.8.0",
"libp2p-websockets": "^0.8.0",
"multiaddr": "^2.0.0",
"pre-commit": "^1.1.2",
"pull-file": "^0.5.0",
Expand All @@ -51,7 +51,7 @@
},
"dependencies": {
"browserify-zlib": "github:ipfs/browserify-zlib",
"interface-connection": "^0.1.8",
"interface-connection": "^0.2.1",
"lodash.noop": "^3.0.1",
"pull-stream-to-stream": "^1.3.1",
"spdy-transport": "^2.0.14",
Expand Down
7 changes: 7 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ function create (rawConn, isListener) {
// Let it flow, let it flooow
conn.resume()

conn.on('end', () => {
// Cleanup and destroy the connection when it ends
// as the converted stream doesn't emit 'close'
// but .destroy will trigger a 'close' event.
conn.destroy()
})

const spdyMuxer = spdy.connection.create(conn, {
protocol: 'spdy',
isServer: isListener
Expand Down

0 comments on commit 4d23827

Please sign in to comment.