Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Fix/rollback block-stream #146

Merged
merged 6 commits into from
Jun 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
<a name="0.15.2"></a>
## [0.15.2](https://github.com/libp2p/js-libp2p-webrtc-star/compare/v0.15.0...v0.15.2) (2018-06-01)


### Bug Fixes

* race condition using pump ([2e430c1](https://github.com/libp2p/js-libp2p-webrtc-star/commit/2e430c1))


### Features

* using block-stream to control webRTC transport ([8d76dd0](https://github.com/libp2p/js-libp2p-webrtc-star/commit/8d76dd0))



<a name="0.15.1"></a>
## [0.15.1](https://github.com/libp2p/js-libp2p-webrtc-star/compare/v0.15.0...v0.15.1) (2018-06-01)

Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ const ws2 = new WStar({ wrtc: electronWebRTC() })
const WStar = require('libp2p-webrtc-star')

const ws = new WStar()

// defining maximum allowed buffer (defaults to 16kb)
const ws3 = new Wstar({
blockStreamSize: 64 * 1024 // 64kb
})
```

## API
Expand Down Expand Up @@ -99,7 +94,7 @@ Defaults:
## Hosted Rendezvous Server

We host a signalling server at `star-signal.cloud.ipfs.team` that can be used for practical demos and experimentation, it **should not be used for apps in production**.
A libp2p-webrtc-star address, using the signalling server we provide, looks like:
A libp2p-webrtc-star address, using the signalling server we provide, looks like:

`/dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star/ipfs/<your-peer-id>`

Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "libp2p-webrtc-star",
"version": "0.15.2",
"version": "0.15.1",
"description": "libp2p WebRTC transport that includes a discovery mechanism provided by the signalling-star",
"main": "src/index.js",
"bin": {
Expand Down Expand Up @@ -58,7 +58,6 @@
},
"dependencies": {
"async": "^2.6.0",
"block-stream": "0.0.9",
"class-is": "^1.1.0",
"debug": "^3.1.0",
"detect-node": "^2.0.3",
Expand All @@ -73,7 +72,6 @@
"peer-id": "~0.10.7",
"peer-info": "~0.14.1",
"pull-stream": "^3.6.8",
"pump": "^3.0.0",
"simple-peer": "^9.1.1",
"socket.io": "^2.1.0",
"socket.io-client": "^2.1.0",
Expand All @@ -92,7 +90,6 @@
"Pedro Teixeira <i@pgte.me>",
"Richard Littauer <richard.littauer@gmail.com>",
"Steverman <Steverman@users.noreply.github.com>",
"Yahya <ya7yaz@gmail.com>",
"dmitriy ryajov <dryajov@dmitriys-MBP.HomeNET>",
"greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>",
"greenkeeperio-bot <support@greenkeeper.io>",
Expand Down
21 changes: 2 additions & 19 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ const PeerId = require('peer-id')
const PeerInfo = require('peer-info')
const Connection = require('interface-connection').Connection
const toPull = require('stream-to-pull-stream')
const BlockStream = require('block-stream')
const pump = require('pump')
const once = require('once')
const setImmediate = require('async/setImmediate')
const webrtcSupport = require('webrtcsupport')
Expand Down Expand Up @@ -43,8 +41,6 @@ class WebRTCStar {
this.wrtc = options.wrtc
}

this.blockStreamSize = options.blockStreamSize || 16 * 1024

this.discovery = new EE()
this.discovery.start = (callback) => { setImmediate(callback) }
this.discovery.stop = (callback) => { setImmediate(callback) }
Expand Down Expand Up @@ -73,14 +69,7 @@ class WebRTCStar {

const channel = new SimplePeer(spOptions)

const block = new BlockStream(this.blockStreamSize, {nopad: true})

pump(channel, block, channel, (err) => {
if (err) return callback(err)
})

const conn = new Connection(toPull.duplex(block))

const conn = new Connection(toPull.duplex(channel))
let connected = false

channel.on('signal', (signal) => {
Expand Down Expand Up @@ -180,13 +169,7 @@ class WebRTCStar {

const channel = new SimplePeer(spOptions)

const block = new BlockStream(this.blockStreamSize, {nopad: true})

pump(channel, block, channel, (err) => {
if (err) return callback(err)
})

const conn = new Connection(toPull.duplex(block))
const conn = new Connection(toPull.duplex(channel))

channel.once('connect', () => {
conn.getObservedAddrs = (callback) => {
Expand Down