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

Commit

Permalink
chore: update deps, clean examples
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Sep 12, 2016
1 parent a5317b1 commit 750f8fa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
10 changes: 9 additions & 1 deletion examples/dialer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@ const pull = require('pull-stream')
const toPull = require('stream-to-pull-stream')
const libp2pSPDY = require('../src')

// const socket = tcp.connect(9999, '10.0.1.12')
const socket = tcp.connect(9999)

const muxer = libp2pSPDY.dialer(toPull(socket))

/*
muxer.on('stream', (stream) => {
console.log('-> got new muxed stream')
pull(stream, pull.log, stream)
pull(
stream,
pull.log,
stream
)
})
*/

console.log('-> opening a stream from my side')
const stream = muxer.newStream((err) => {
Expand Down
9 changes: 5 additions & 4 deletions examples/listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ const listener = tcp.createServer((socket) => {
const muxer = libp2pSPDY.listener(toPull(socket))

muxer.on('stream', (stream) => {
console.log('-> got new muxed stream')
console.log('INCOMMING MUXED STREAM')
pull(
stream,
pull.through((data) => {
pull.drain((data) => {
console.log('DO I GET DATA?', data)
}),
stream
})
)
})

/*
console.log('-> opening a stream from my side')
const stream = muxer.newStream((err) => {
if (err) throw err
Expand All @@ -31,6 +31,7 @@ const listener = tcp.createServer((socket) => {
pull.values(['hey, how is it going']),
stream
)
*/
})

listener.listen(9999, () => {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"pull-pair": "^1.1.0",
"pull-stream": "^3.4.3",
"run-parallel": "^1.1.6",
"stream-to-pull-stream": "^1.7.0",
"tap-spec": "^4.1.1",
"tape": "^4.2.0"
},
Expand All @@ -65,4 +64,4 @@
"greenkeeperio-bot <support@greenkeeper.io>",
"nginnever <ginneversource@gmail.com>"
]
}
}
1 change: 0 additions & 1 deletion src/muxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ module.exports = class Muxer extends EventEmitter {
headers: {}
}, (err, stream) => {
conn.setInnerConn(toPull.duplex(stream), this.conn)

callback(err, conn)
})

Expand Down

0 comments on commit 750f8fa

Please sign in to comment.